Bug Tracker

Opened 11 years ago

Closed 9 years ago

Last modified 8 years ago

#3818 closed bug (worksforme)

$.ajax() requires data param if type is POST

Reported by: ibrahim Owned by:
Priority: minor Milestone: 1.3
Component: ajax Version: 1.2.6
Keywords: Cc:
Blocked by: Blocking:

Description

if i didn't set data option in $.ajax(); with type : "POST" the request will fail.

$('a').click(function () {

$.ajax({

url: $(this).attr('href'),

type: 'POST',

data: ,

success: function(data) { $('div').html(data); }

});

return false;

});

Attachments (1)

error.jpg (15.2 KB) - added by ibrahim 11 years ago.

Download all attachments as: .zip

Change History (4)

Changed 11 years ago by ibrahim

Attachment: error.jpg added

comment:1 Changed 11 years ago by dmethvin

Summary: Problem with $.ajax();$.ajax() requires data param if type is POST

So if data is not supplied, you would want a POST with Content-length 0?

comment:2 Changed 11 years ago by dmethvin

Could you provide some feedback on the expected behavior? Although jQuery could set content-length=0 and do the POST, it seems like omitting the data parameter is most likely an error in the caller's code.

comment:3 Changed 9 years ago by Rick Waldron

Resolution: worksforme
Status: newclosed

This issue appears to be no longer existent

http://jsfiddle.net/rwaldron/WKfkh/9/

The ticket may be reopened if a new test case showing the broken behavior is submitted.

Note: See TracTickets for help on using tickets.