From: John Resig Date: Wed, 11 Nov 2009 19:55:32 +0000 (-0500) Subject: Added a check to make sure that a load request isn't done if the element doesn't... X-Git-Url: http://git.asbjorn.it/?a=commitdiff_plain;h=357e2ae98908478bcb624b5db68098772a0548c2;p=jquery.git Added a check to make sure that a load request isn't done if the element doesn't exist. Fixes #4235. --- diff --git a/src/ajax.js b/src/ajax.js index 201636d..697365a 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -15,6 +15,10 @@ jQuery.fn.extend({ load: function( url, params, callback ) { if ( typeof url !== "string" ) { return this._load( url ); + + // Don't do a request if no elements are being requested + } else if ( !this.length ) { + return this; } var off = url.indexOf(" ");