Skip to main content

Bug Tracker

Side navigation

#9757 closed bug (wontfix)

Opened July 06, 2011 12:14PM UTC

Closed July 11, 2011 11:43PM UTC

ajaxPrefilter

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

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".

Attachments (0)
Change History (3)

Changed July 11, 2011 08:23PM UTC by addyosmani comment:1

cc: → jaubourg

Changed July 11, 2011 09:46PM UTC by ajpiano comment:2

component: unfiledajax

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

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

Changed July 11, 2011 11:43PM UTC by jaubourg comment:3

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.