Skip to content

Commit

Permalink
Fixing request data param issue. Thanks to mislav for the patch. Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jeresig committed Jun 15, 2010
1 parent c34a62f commit c90d609
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ jQuery.extend({

// Send the data
try {
xhr.send( type === "POST" || type === "PUT" || type === "DELETE" ? s.data : null );
xhr.send( (type !== "GET" && s.data) || null );

} catch( sendError ) {
jQuery.ajax.handleError( s, xhr, null, e );
Expand Down
1 change: 1 addition & 0 deletions test/data/echoData.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php echo file_get_contents('php://input'); ?>
13 changes: 13 additions & 0 deletions test/unit/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -1163,6 +1163,19 @@ test("data option: evaluate function values (#2806)", function() {
})
});

test("data option: empty bodies for non-GET requests", function() {
stop();
jQuery.ajax({
url: "data/echoData.php",
data: undefined,
type: "post",
success: function(result) {
equals( result, "" );
start();
}
})
});

test("jQuery.ajax - If-Modified-Since support", function() {
expect( 3 );

Expand Down

0 comments on commit c90d609

Please sign in to comment.