X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fajax%2Fajax.js;h=346fdd71eb672d418bc2f8104cd8c814ac7c70eb;hb=9f93c7b3b858c4491e1d2aa7a680b9b1dd29b17c;hp=98f792a35ea36aea07639415f2cd9ebe1f77c403;hpb=8ac2169dc01f646b9182a03353427f2c48cba49c;p=jquery.git diff --git a/src/ajax/ajax.js b/src/ajax/ajax.js index 98f792a..346fdd7 100644 --- a/src/ajax/ajax.js +++ b/src/ajax/ajax.js @@ -55,7 +55,7 @@ jQuery.fn.extend({ // 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; @@ -132,7 +132,7 @@ jQuery.fn.extend({ }); // 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"); }; @@ -391,6 +391,11 @@ jQuery.extend({ * @cat Ajax */ post: function( url, data, callback, type ) { + if ( jQuery.isFunction( data ) ) { + callback = data; + data = {}; + } + return jQuery.ajax({ type: "POST", url: url, @@ -799,7 +804,7 @@ jQuery.extend({ // 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 ) ); });