Bug Tracker

Opened 12 years ago

Closed 12 years ago

#9757 closed bug (wontfix)


Reported by: anonymous Owned by:
Priority: undecided Milestone: 1.next
Component: ajax Version: 1.6.2
Keywords: Cc: jaubourg
Blocked by: Blocking:


When you use object for your data in an ajax request and want to add more data to this object with "ajaxPrefilter", it does not work, options.data is converted in an url encoded string.

It is better to use an object type for "options.data".

Change History (3)

comment:1 Changed 12 years ago by addyosmani

Cc: jaubourg added

comment:2 Changed 12 years ago by ajpiano

Component: unfiledajax

Confirmed: http://jsfiddle.net/Ae3Kg/

Is this something we should fix or is it intended behaviour?

comment:3 Changed 12 years ago by jaubourg

Resolution: wontfix
Status: newclosed

It is intended behaviour. A string can be passed as data, so decision was taken to serialize non-string data so that a prefilter always has the same "presentation" of the data option.

Relying on data not being a string is wrong and will result in programming errors seeing as a user is perfectly entitled to call ajax with data as a string.

I know it sucks since it means more work in the prefilters to add data in but that's the price to pay for consistency: your prefilter should work with options.data being a string anyway.

Note: See TracTickets for help on using tickets.