$(document).ready(function() {
urlHolder.checkUser = '${checkUser}';
$('#checkUserForm').submit(function() {
checkUser();
});
});
var urlHolder = new Object();
function checkUser() {
$.post(urlHolder.checkUser, {
email : $('#email').val(),
password : $('#password').val(),
}, function(response) {
if (response != null) {
alert('Success! User has been added.');
} else {
alert('Failure! An error has occurred!');
}
});
};
I'm using this code for checking user exist or not. When I used firefox debugger (breakpoint on alert() line ), it worked and server came back a response, but if I didn't put any breakpoint, alert doesn't work, but server came back a response. Note: not only alert() but also window.location.href = " http://stackoverflow.com "; didn't work.
Change the following lines to prevent the form from being submitted:
$('#checkUserForm').submit(function(event) {
event.preventDefault();
checkUser();
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.