complete: function(res, status){
// If successful, inject the HTML into all the matched elements
if ( status == "success" || !ifModified && status == "notmodified" )
- self.html(res.responseText)
+ self.html(res.responseText);
self.each( callback, [res.responseText, status, res] );
}
// Wait for a response to come back
var onreadystatechange = function(isTimeout){
// The transfer is complete and the data is available, or the request timed out
- if ( xml && (xml.readyState == 4 || isTimeout == "timeout") ) {
+ if ( !requestDone && xml && (xml.readyState == 4 || isTimeout == "timeout") ) {
requestDone = true;
// clear poll interval
} else
jQuery.handleError(s, xml, status);
} catch(e) {
- status = "error";
+ status = "parsererror";
jQuery.handleError(s, xml, status, e);
}
*/
httpData: function( r, type ) {
var ct = r.getResponseHeader("content-type");
- var data = !type && ct && ct.indexOf("xml") >= 0;
- data = type == "xml" || data ? r.responseXML : r.responseText;
+ var xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0;
+ data = xml ? r.responseXML : r.responseText;
+
+ if ( xml && data.documentElement.tagName == "parsererror" )
+ throw "parsererror";
// If the type is "script", eval it in global context
if ( type == "script" )
// If the value is an array then the key names need to be repeated
if ( a[j] && a[j].constructor == Array )
jQuery.each( a[j], function(){
- s.push( encodeURIComponent(j) + "=" + encodeURIComponent( this ) );
+ s.push( encodeURIComponent(j) + "[]=" + encodeURIComponent( this ) );
});
else
s.push( encodeURIComponent(j) + "=" + encodeURIComponent( a[j] ) );