Sunday, 15 January 2012

javascript - jQuery .done not firing on a $.post request -



javascript - jQuery .done not firing on a $.post request -

firstly, here's illustration code:

$.post( "test.php", { testdata : "signal" }, function( info ) { alert( "nested function" )}) .done( function () { alert( "done function" )});

i'm trying .done accomplish stuff me, doesn't matter what. won't fire, regardless of whether or not nest function straight in $.post parameters. checking console on chrome shows it's throwing error of uncaught typeerror: undefined not function

playing around lines , error study shows me it's .done that's throwing error, , moving .done straight after $.post's close paren isn't effective.

there similar question saw, $.ajax, , i've attempted implement chaining suggest, above, no effect. missing?

edit: jquery version 1.4.4, .post returns data, , .always fails.

use .complete instead:

$.post("test.php", { testdata : "signal" }, function () { alert("nested function"); }) .complete(function () { alert("done function"); });

fiddle

javascript jquery ajax post

No comments:

Post a Comment