git.asbjorn.biz
/
jquery.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixes a regression by calling dataFilter with the second argument set as the dataType.
[jquery.git]
/
src
/
ajax.js
diff --git
a/src/ajax.js
b/src/ajax.js
index
d570fcc
..
2c658b1
100644
(file)
--- a/
src/ajax.js
+++ b/
src/ajax.js
@@
-61,26
+61,34
@@
jQuery.fn.extend({
type: type,
dataType: "html",
data: params,
type: type,
dataType: "html",
data: params,
- complete: function( res, status ) {
+ // Complete callback (responseText is used internally)
+ complete: function( jXHR, status, responseText ) {
+ // Store the response as specified by the jXHR object
+ responseText = jXHR.responseText;
// If successful, inject the HTML into all the matched elements
// If successful, inject the HTML into all the matched elements
- if ( status === "success" || status === "notmodified" ) {
+ if ( jXHR.isResolved() ) {
+ // #4825: Get the actual response in case
+ // a dataFilter is present in ajaxSettings
+ jXHR.done(function( r ) {
+ responseText = r;
+ });
// See if a selector was specified
self.html( selector ?
// Create a dummy div to hold the results
jQuery("<div>")
// inject the contents of the document in, removing the scripts
// to avoid any 'Permission Denied' errors in IE
// See if a selector was specified
self.html( selector ?
// Create a dummy div to hold the results
jQuery("<div>")
// inject the contents of the document in, removing the scripts
// to avoid any 'Permission Denied' errors in IE
- .append(res.responseText.replace(rscript, ""))
+ .append(responseText.replace(rscript, ""))
// Locate the specified elements
.find(selector) :
// If not, just inject the full result
// Locate the specified elements
.find(selector) :
// If not, just inject the full result
- res.responseText );
+ responseText );
}
if ( callback ) {
}
if ( callback ) {
- self.each( callback, [res.responseText, status, res] );
+ self.each( callback, [responseText, status, jXHR] );
}
}
});
}
}
});
@@
-152,7
+160,7
@@
jQuery.extend({
},
ajaxSetup: function( settings ) {
},
ajaxSetup: function( settings ) {
- jQuery.extend( jQuery.ajaxSettings, settings );
+ jQuery.extend( true, jQuery.ajaxSettings, settings );
},
ajaxSettings: {
},
ajaxSettings: {
@@
-266,6
+274,9
@@
jQuery.extend({
transport,
// timeout handle
timeoutTimer,
transport,
// timeout handle
timeoutTimer,
+ // Cross-domain detection vars
+ loc = document.location,
+ parts,
// The jXHR state
state = 0,
// Loop variable
// The jXHR state
state = 0,
// Loop variable
@@
-445,7
+456,7
@@
jQuery.extend({
}
} else if ( s.dataFilter ) {
}
} else if ( s.dataFilter ) {
- response = s.dataFilter( response );
+ response = s.dataFilter( response , current );
dataTypes = s.dataTypes;
}
}
dataTypes = s.dataTypes;
}
}
@@
-519,10
+530,8
@@
jQuery.extend({
s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( /\s+/ );
// Determine if a cross-domain request is in order
s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( /\s+/ );
// Determine if a cross-domain request is in order
- var parts = rurl.exec( s.url.toLowerCase() ),
- loc = location;
-
if ( ! s.crossDomain ) {
if ( ! s.crossDomain ) {
+ parts = rurl.exec( s.url.toLowerCase() );
s.crossDomain = !!(
parts &&
( parts[ 1 ] && parts[ 1 ] != loc.protocol ||
s.crossDomain = !!(
parts &&
( parts[ 1 ] && parts[ 1 ] != loc.protocol ||