I have a VERY simple jQuery Ajax call (below). The Ajax call executes and I can see in the Firebug Net panel that the server returned 200 OK and returned a string "OK" as it should. However, the done and fail functions do not fire! Very frustrating!
(The "before" and "after" alerts DO fire. )
For simplicity (and as a debugging technique) I have stripped this down to it's most bare skeleton but still the handlers won't fire. What am I not seeing here?
postUrl= "/mod/users/check_email/";
dataToPost= { email: "[email protected]" };
alert("before");
$.ajax
({
type: "POST",
url: postUrl,
data: dataToPost,
done: function()
{
alert("Success.");
},
fail: function()
{
alert("Sorry. Server unavailable. ");
},
}); // end Ajax call
alert("after");
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…