Bug Tracker

Modify

Ticket #9757 (closed bug: wontfix)

Opened 2 years ago

Last modified 2 years ago

ajaxPrefilter

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

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

Change History

comment:1 Changed 2 years ago by addyosmani

  • Cc jaubourg added

comment:2 Changed 2 years ago by ajpiano

  • Component changed from unfiled to ajax

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

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

comment:3 Changed 2 years ago by jaubourg

  • Status changed from new to closed
  • Resolution set to wontfix

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.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.