Closed derylihs closed 10 years ago
So this is on an Android device? You say you're doing and Ajax request, please post the exact error message if possible so I can get a better idea what is going on.
Uncaught TypeError: Cannot read property 'classList' of undefined chui-3.5.1.js:1135
a.fn.extend.UIPopupClose chui-3.5.1.js:1135
(anonymous function) login.php:70
jQuery.event.dispatch jquery-latest.js:5095
elemData.handle jquery-latest.js:4767
jQuery.event.trigger jquery-latest.js:5007
done jquery-latest.js:8253
callback jquery-latest.js:8778
i dont understand this, help me to explain this error
ty for respond
It looks like you're trying to close a popup that no longer exists, therefore it can't find the class for it. Are you removing the popup at some point?
i remove it when ajax load complete
$(document).ajaxComplete(function () {
$('.popup').UIPopupClose()
});
Actually, you've uncovered a bug. Here's how to fix it. Open up in src/chui/popup.js Go to line 1083: Change: if (!this[0].classList.contains('popup')) return; To: if (!this && !this.classList.contains('popup')) return; run grunt chuijs to recompile chui.js You should be fine. I'll roll this into 3.5.2
ooo this is a bug..
thank you for your respond sir
i found this when loading the ajax..
this is first time i send post via ajax
second time send post via ajax
and third time send post via ajax
so when i send 4 time 5 time 6 time the loading popup show 4 5 6
In your success, when you use $.UIUnblock, also do: $('.busy').remove();
Oh, looks like you also not using $.UIUnblock. So when you do an Ajax request, have a success and an error function. In both make sure you have these two lines: $.UIUnblock(); $('.busy').remove(); That way if there is success or error the overlay and busy indicator get removed.
I hope that's clear.
$.ajax({
type: "POST",
url: "remote/login.php",
data: datalogin,dataType: 'json',
success: function(forms) {
$.UIUnblock();
$('.busy').remove();
// Handle the success:
},
error: function() {
$.UIUnblock();
$('.busy').remove();
// Handle error
}
});
still get some problem sir always show twice when i got error twice
I"m not sure what you're saying. What shows twice, and how are you getting an error twice? Do you have error messages?
sorry i mean when i send ajax post twice the loading popup show twice
Are you on Skype?
yes account name: deryl.oioi
Actually it looks like you had a syntax error in your code. You have the following code:
$( "#btn-login" ).click(function() {
var datalogin = {
username: $("#username").val(),
password: $("#password").val()
};
$(document).ajaxStart(function () {
$.UIPopup({empty: true});
$('.popup').UIBusy({'color':'orange', 'size': '80px'})
});
$(document).ajaxComplete(function () {
$('.popup').UIPopupClose()
});
$.ajax({
type: "POST",
url: "remote/login.php",
data: datalogin,dataType: 'json',
success: function(forms) {
if(forms == '1') {
$("#warning").html("<div class='alert alert-success'><button type='button' class='close' data-dismiss='alert'>×</button><strong><i class='fa fa-check'></i> Success!</strong> Will be redirect in 5 sec <i class='icon-spin icon-spinner'></i> <meta http-equiv='refresh' content='2;URL=index.php'></div>");
} else {
$("#warning").html("<strong>Error!</strong> Wrong username or password</div>");
}
});
});
Get rid of the ajaxComplete and do the following:
$( "#btn-login" ).click(function() {
var datalogin = {
username: $("#username").val(),
password: $("#password").val()
};
$(document).ajaxStart(function () {
$.UIPopup({empty: true});
$('.popup').UIBusy({'color':'orange', 'size': '80px'});
});
$.ajax({
type: "POST",
url: "remote/login.php",
data: datalogin,dataType: 'json',
success: function(forms) {
if(forms == '1') {
$('.popup').UIPopupClose();
$("#warning").html("<div class='alert alert-success'><button type='button' class='close' data-dismiss='alert'>×</button><strong><i class='fa fa-check'></i> Success!</strong> Will be redirect in 5 sec <i class='icon-spin icon-spinner'></i> <meta http-equiv='refresh' content='2;URL=index.php'></div>");
} else {
$('.popup').UIPopupClose();
$("#warning").html("<strong>Error!</strong> Wrong username or password</div>");
}
},
error: function() {
$('.popup').UIPopupClose();
// Handle error in ajax request.
// Change this to what you need:
alert('Had a problem performing request.');
}
});
});
still same problem sir
Skype: rombiggs
after second time send data i see the error
this is my code