X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fajax.js;h=a5a08ecd6d210741013e78416ba88d5dee910676;hb=06c2f06a2183ef17a8119ef25a383a02572c0b55;hp=35995f6b640584cf3eae13a2a099486f8d82ba39;hpb=e1af5faf80ff9a457bcb78757c3eb04b55e931d1;p=jquery.git diff --git a/src/ajax.js b/src/ajax.js index 35995f6..a5a08ec 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -34,6 +34,7 @@ jQuery.fn.extend({ jQuery.ajax({ url: url, type: type, + dataType: "html", data: params, complete: function(res, status){ // If successful, inject the HTML into all the matched elements @@ -255,17 +256,20 @@ jQuery.extend({ // Open the socket xml.open(s.type, s.url, s.async); - // Set the correct header, if data is being sent - if ( s.data ) - xml.setRequestHeader("Content-Type", s.contentType); + // Need an extra try/catch for cross domain requests in Firefox 3 + try { + // Set the correct header, if data is being sent + if ( s.data ) + xml.setRequestHeader("Content-Type", s.contentType); - // Set the If-Modified-Since header, if ifModified mode. - if ( s.ifModified ) - xml.setRequestHeader("If-Modified-Since", - jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" ); + // Set the If-Modified-Since header, if ifModified mode. + if ( s.ifModified ) + xml.setRequestHeader("If-Modified-Since", + jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" ); - // Set header so the called script knows that it's an XMLHttpRequest - xml.setRequestHeader("X-Requested-With", "XMLHttpRequest"); + // Set header so the called script knows that it's an XMLHttpRequest + xml.setRequestHeader("X-Requested-With", "XMLHttpRequest"); + } catch(e){} // Allow custom headers/mimetypes if ( s.beforeSend )