X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fajax%2Fajax.js;h=7eb1b91c30e16403878931b0e1590c067eb753c4;hb=02ffee4610a24481aab1cac7676da2a207e3684b;hp=9c94e13d38f8c6e0f9c2c8da7aacd6e65100a248;hpb=32f688d303ed3cbb942df421c5bb2ed7a5d5244c;p=jquery.git diff --git a/src/ajax/ajax.js b/src/ajax/ajax.js index 9c94e13..7eb1b91 100644 --- a/src/ajax/ajax.js +++ b/src/ajax/ajax.js @@ -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, @@ -594,9 +599,12 @@ jQuery.extend({ if (s.processData && typeof s.data != "string") s.data = jQuery.param(s.data); // append data to url for get requests - if( s.type.toLowerCase() == "get" ) + if( s.type.toLowerCase() == "get" ) { // "?" + data or "&" + data (in case there are already params) s.url += ((s.url.indexOf("?") > -1) ? "&" : "?") + s.data; + // IE likes to send both get and post data, prevent this + s.data = null; + } } // Watch for a new set of requests @@ -799,7 +807,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 ) ); });