Bug Tracker

Modify

Ticket #5709 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

$.ajax() - type is json if dataType is unspecified and c-t is "application/json"

Reported by: rwaldron Owned by:
Priority: trivial Milestone: 1.4
Component: ajax Version: 1.4a2
Keywords: Cc: rwaldron
Blocking: Blocked by:

Description

$.ajax() enhancement to treat a server's response ('data', from xhr.responseText) as json if dataType is unspecified and the response content-type is "application/json".

Attachments

httpData.js Download (1.2 KB) - added by rwaldron 3 years ago.
httpData method

Change History

Changed 3 years ago by rwaldron

httpData method

comment:2 Changed 3 years ago by webbiedave

I think it's a more secure approach to require an explicit request for auto-detection/parsing. Otherwise, it wouldn't be out of the realm of possibility that scripts could be evaluated simply by leaving dataType unspecified (which many existing apps do).

I've created a ticket for a new dataType setting "auto" which provides this functionality:

 http://dev.jquery.com/ticket/5718

comment:3 Changed 3 years ago by john

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

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.