X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fajax%2Fajax.js;h=485bf1b82bd5f79c1d2d95b1cb6185d594ae5525;hb=98b1b580c7298c1ced00f9ec4d65452b4d559da7;hp=9d4e8b512862d21d10cbff4d3a26fd3a70878401;hpb=6b8ffe79f4e616d6179f6b16099e7c25e7ae5cb1;p=jquery.git
diff --git a/src/ajax/ajax.js b/src/ajax/ajax.js
index 9d4e8b5..485bf1b 100644
--- a/src/ajax/ajax.js
+++ b/src/ajax/ajax.js
@@ -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
* @result 45 feeds found.
@@ -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.