// If the second parameter was provided
if ( params )
// If it's a function
- if ( jQuery.isFunction( params.constructor ) ) {
+ if ( jQuery.isFunction( params ) ) {
// We assume that it's the callback
callback = params;
params = null;
});
// If IE is used, create a wrapper for the XMLHttpRequest object
-if ( jQuery.browser.msie && typeof XMLHttpRequest == "undefined" )
+if ( !window.XMLHttpRequest )
XMLHttpRequest = function(){
return new ActiveXObject("Microsoft.XMLHTTP");
};
* @cat Ajax
*/
post: function( url, data, callback, type ) {
+ if ( jQuery.isFunction( data ) ) {
+ callback = data;
+ data = {};
+ }
+
return jQuery.ajax({
type: "POST",
url: url,
timeout: 0,
contentType: "application/x-www-form-urlencoded",
processData: true,
- async: true
+ async: true,
+ data: null
},
// Last-Modified header cache for next request
// Serialize the key/values
for ( var j in a )
// If the value is an array then the key names need to be repeated
- if ( a[j].constructor == Array )
+ if ( a[j] && a[j].constructor == Array )
jQuery.each( a[j], function(){
s.push( encodeURIComponent(j) + "=" + encodeURIComponent( this ) );
});