(function( jQuery ) {
-
+
var rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
rselectTextarea = /^(?:select|textarea)/i,
rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
type = "POST";
}
}
-
+
var self = this;
-
+
// Request the remote document
jQuery.ajax({
url: url,
};
});
-jQuery.each( [ "GET", "POST" ], function( i, method ) {
- jQuery[ method.toLowerCase() ] = function( url, data, callback, type ) {
+jQuery.each( [ "get", "post" ], function( i, method ) {
+ jQuery[ method ] = function( url, data, callback, type ) {
// shift arguments if data argument was omited
if ( jQuery.isFunction( data ) ) {
type = type || callback;
text: "Text",
json: "JSON"
},
-
+
accepts: {
xml: "application/xml, text/xml",
html: "text/html",
json: "application/json, text/javascript",
"*": "*/*"
},
-
+
autoDataType: {
xml: /xml/,
html: /html/,
json: /json/
},
-
+
// Prefilters
// 1) They are useful to introduce custom dataTypes (see transport/jsonp for an example)
// 2) These are called:
// * AFTER param serialization (s.data is a string if s.processData is true)
// 3) They MUST be order agnostic
prefilters: [],
-
+
// Transports bindings
// 1) key is the dataType
// 2) the catchall symbol "*" can be used
// 3) selection will start with transport dataType and THEN go to "*" if needed
transports: {
},
-
+
// Checkers
// 1) key is dataType
// 2) they are called to control successful response
// 3) error throws is used as error data
dataCheckers: {
-
+
// Check if data is a string
"text": function(data) {
if ( typeof data != "string" ) {
jQuery.error("typeerror");
}
},
-
+
// Check if xml has been properly parsed
"xml": function(data) {
var documentElement = data ? data.documentElement : data;
}
}
},
-
+
// List of data converters
// 1) key format is "source_type => destination_type" (spaces required)
// 2) the catchall symbol "*" can be used for source_type
dataConverters: {
-
+
// Convert anything to text
"* => text": function(data) {
return "" + data;
},
-
+
// Text to html (no transformation)
"text => html": function(data) {
return data;
},
-
+
// Evaluate text as a json expression
"text => json": jQuery.parseJSON,
-
+
// Parse text as xml
"text => xml": function(data) {
var xml, parser;
// Main method
ajax: function( url , s ) {
-
+
if ( arguments.length === 1 ) {
s = url;
url = s ? s.url : undefined;
}
-
+
return jQuery.xhr().open( s ? s.type : undefined , url ).send( undefined , s );
-
+
},
// Serialize an array of form elements or a set of
value = jQuery.isFunction(value) ? value() : value;
s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
};
-
+
// Set traditional to true for jQuery <= 1.3.2 behavior.
if ( traditional === undefined ) {
traditional = jQuery.ajaxSettings.traditional;
}
-
+
// If an array was passed in, assume that it is an array of form elements.
if ( jQuery.isArray(a) || a.jquery ) {
// Serialize the form elements
jQuery.each( a, function() {
add( this.name, this.value );
});
-
+
} else {
// If traditional, encode the "old" way (the way 1.3.2 or older
// did it), otherwise encode params recursively.
buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add );
}
});
-
+
} else if ( !traditional && obj != null && typeof obj === "object" ) {
// If we see an array here, it is empty and should be treated as an empty
// object
buildParams( prefix + "[" + k + "]", v, traditional, add );
});
}
-
+
} else {
// Serialize scalar item.
add( prefix, obj );
return new window.XMLHttpRequest();
} catch( xhrError ) {}
}
-
+
try {
return new window.ActiveXObject("Microsoft.XMLHTTP");
} catch( activeError ) {}