I try use query ajax and when I have "return false" I get callback as well
$(document).ready(function(){
$("form#Form").submit(function(){
$.ajax({
url: "ajax.php",
type: "POST",
data: $(this).serialize(),
success: function(callback){
alert(callback);
} //success
}); //ajax
return false;
}); //submit
}); //ready
in the php file I just echo "dennis", it works and I get alert with content "dennis". when I try something like this:
$(document).ready(function(){
$("form#Form").submit(function(){
$.ajax({
url: "ajax.php",
type: "POST",
data: $(this).serialize(),
success: function(callback){
alert(callback);
} //success
}); //ajax
if (callback == "dennis"){
return false;
}else{
return true;
}
}); //submit
}); //ready
I get empty alert and the form act like he get "return true". I also try put variable and return him, but still same problem..
why it happened? how fix it?