jquery ajax done function not firing

You need to chain the done() and fail() functions, they are not part of the options object used in $.ajax :

$.ajax({
    type: "POST", 
    url : postUrl,
    data: dataToPost
}).done(function()  {
    alert("Success.");
}).fail(function()  {
    alert("Sorry. Server unavailable. ");
}); 

Also, as ajax is asynchronous, don’t be suprised if the “after” alert comes before the “success” alert.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)