Fixed typo
[jquery.git] / src / ajax / ajax.js
index 9d4e8b5..2e222d4 100644 (file)
@@ -22,6 +22,8 @@ jQuery.fn.extend({
        /**
         * Load HTML from a remote file and inject it into the DOM.
         *
+        * Note: Avoid to use this to load scripts, instead use $.getScript.
+        *
         * @example $("#feeds").load("feeds.html");
         * @before <div id="feeds"></div>
         * @result <div id="feeds"><b>45</b> feeds found.</div>
@@ -473,7 +475,7 @@ jQuery.extend({
         * Last-Modified header. Default value is false, ignoring the header.
         *
         * (Number) timeout - Local timeout to override global timeout, eg. to give a
-        * single request a longer timeout while all others timeout after 1 seconds.
+        * single request a longer timeout while all others timeout after 1 second.
         * See $.ajaxTimeout() for global timeouts.
         *
         * (Boolean) global - Whether to trigger global AJAX event handlers for
@@ -645,6 +647,8 @@ jQuery.extend({
                                                // Fire the global callback
                                                if( s.global )
                                                        jQuery.event.trigger( "ajaxSuccess", [xml, s] );
+                                       } else {
+                                               jQuery.handleError(s, xml, status);
                                        }
                                } catch(e) {
                                        status = "error";
@@ -712,18 +716,24 @@ jQuery.extend({
 
        // Determines if an XMLHttpRequest was successful or not
        httpSuccess: function(r) {
-               return !r.status && location.protocol == "file:" ||
-                       ( r.status >= 200 && r.status < 300 ) || r.status == 304 ||
-                       jQuery.browser.safari && r.status == undefined;
+               try {
+                       return !r.status && location.protocol == "file:" ||
+                               ( r.status >= 200 && r.status < 300 ) || r.status == 304 ||
+                               jQuery.browser.safari && r.status == undefined;
+               } catch(e){}
+               return false;
        },
 
        // Determines if an XMLHttpRequest returns NotModified
        httpNotModified: function(xml, url) {
-               var xmlRes = xml.getResponseHeader("Last-Modified");
+               try {
+                       var xmlRes = xml.getResponseHeader("Last-Modified");
 
-               // Firefox always returns 200. check Last-Modified date
-               return xml.status == 304 || xmlRes == jQuery.lastModified[url] ||
-                       jQuery.browser.safari && xml.status == undefined;
+                       // Firefox always returns 200. check Last-Modified date
+                       return xml.status == 304 || xmlRes == jQuery.lastModified[url] ||
+                               jQuery.browser.safari && xml.status == undefined;
+               } catch(e){}
+               return false;
        },
 
        /* Get the data out of an XMLHttpRequest.