Callback function is not executed
The pr开发者_运维知识库oblem is that data is successfully transfered to the server, but the callback function is never executed in both versions:
$.post(action, formData, function (data) { alert('121'); });
or
$.ajax({
type: "POST",
url: action,
data: formData,
dataType: "html",
success: function(msg){
alert('23');
}
});
JQuery 1.4.1
Thank you!
Perhaps you are generating an error? You could try switching it to a .ajax() call and hook into the error handlers to see if this is occurring.
take
$.ajax({
type: "POST",
url: action,
data: formData,
dataType: "html",
success: function(msg){
alert('23');
}
});
and add
error: function(error) {
console.log("an error", error);
}
using firebug.
it may submit correctly but not receive a valid response.
Using firebug you can watch the requests going to and coming back from the server to make sure your getting what you expect and that the status code is a 200 in the Net tab. Console.log will also output the response from the error in the console view.
精彩评论