jQuery.ajax("data/name.html").success(function() { ok( true, "With only string URL argument" ); }),
jQuery.ajax("data/name.html", {} ).success(function() { ok( true, "With string URL param and map" ); }),
jQuery.ajax({ url: "data/name.html"} ).success(function() { ok( true, "With only map" ); })
- ).then( start, start );
+ ).always(functionunction() {
+ start();
+ });
});
},
error: function(){ ok(false, "error"); }
- }).then( start, start );
+ }).always(function() {
+ start();
+ });
});
test("load(String)", function() {
expect(1);
stop(); // check if load can be called with only url
- jQuery("#first").load("data/name.html", start);
+ jQuery("#first").load("data/name.html", function() {
+ start();
+ });
});
test("load('url selector')", function() {
data: { header: "ecma" }
})
- ).then( start, start );
+ ).always(function() {
+ start();
+ });
});
test("jQuery.ajax() - json by content-type", function() {
jQuery.when(
jQuery.post( url( "data/name.php" ), { xml: "5-2", length: 3 }, function( xml ) {
- jQuery( "math", xml ).each( function() {
+ jQuery( "math", xml ).each(function() {
equals( jQuery( "calculation", this ).text(), "5-2", "Check for XML" );
equals( jQuery( "result", this ).text(), "3", "Check for XML" );
});
strictEqual( data, "test%5Blength%5D=7&test%5Bfoo%5D=bar", "Check if a sub-object with a length param is serialized correctly");
}
})
- // The more compact then( start, start ) doesn't work in IE7
- ).then( function() {
- start();
- }, function() {
+ ).always(function() {
start();
- } );
+ });
});
jQuery.ajax( url( uri ) , {
complete: function(jqXHR) {
- setTimeout( function() {
+ setTimeout(function() {
jqXHR.statusCode( createStatusCodes( "very late binding" , isSuccess ) );
countComplete();
} , 100 );
statusCode: createStatusCodes( "all (options)" , isSuccess ),
complete: function(jqXHR) {
jqXHR.statusCode( createStatusCodes( "all (on complete)" , isSuccess ) );
- setTimeout( function() {
+ setTimeout(function() {
jqXHR.statusCode( createStatusCodes( "all (very late binding)" , isSuccess ) );
countComplete();
} , 100 );
}
})
- ).then( start , start );
+ ).always(function() {
+ start();
+ });
});
}
})
- ).then( start , start );
+ ).always(function() {
+ start();
+ });
});