X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fajax%2Fajax.js;h=bcf9472d8b81af572a1a8507f1200db9c30f908b;hb=2e544e9eb89c87b9eac6df445474d21e9be604eb;hp=6e56fa45dd2444396abcdebf0dcf41fa4ac2cc62;hpb=eee853f120b61673191ffbbbf97e8ebb2f545751;p=jquery.git diff --git a/src/ajax/ajax.js b/src/ajax/ajax.js index 6e56fa4..bcf9472 100644 --- a/src/ajax/ajax.js +++ b/src/ajax/ajax.js @@ -39,6 +39,13 @@ jQuery.fn.extend({ * start(); * }); * + * @test stop(); // check if load can be called with only url + * $('#first').load("data/name.php"); + * $.get("data/name.php", function() { + * ok( $('#first').text() == 'ERROR', 'Check if load works without callback'); + * start(); + * }); + * * @name load * @type jQuery * @param String url The URL of the HTML file to load. @@ -80,9 +87,9 @@ jQuery.fn.extend({ self.html(res.responseText).each( callback, [res.responseText, status] ); // Execute all the scripts inside of the newly-injected HTML - $("script", self).each(function(){ + jQuery("script", self).each(function(){ if ( this.src ) - $.getScript( this.src ); + jQuery.getScript( this.src ); else eval.call( window, this.text || this.textContent || this.innerHTML || "" ); }); @@ -117,7 +124,7 @@ jQuery.fn.extend({ * @cat AJAX */ serialize: function() { - return $.param( this ); + return jQuery.param( this ); } }); @@ -281,6 +288,18 @@ jQuery.extend({ * } * ) * + * @test stop(); + * $.get('data/dashboard.xml', function(xml) { + * var content = []; + * $('tab', xml).each(function() { + * content.push($(this).text()); + * }); + * ok( content[0] == 'blabla', 'Check first tab'); + * ok( content[1] == 'blublu', 'Check second tab'); + * start(); + * }); + * + * * @name $.get * @type jQuery * @param String url The URL of the page to load.