Skip to main content

Bug Tracker

Side navigation

#5709 closed enhancement (fixed)

Opened December 23, 2009 09:37PM UTC

Closed January 06, 2010 12:49AM UTC

$.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
Blocked by: Blocking:
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 (1)
  • httpData.js (1.2 KB) - added by rwaldron December 23, 2009 10:04PM UTC.

    httpData method

Change History (3)

Changed December 26, 2009 09:26PM UTC by webbiedave comment:2

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

Changed January 06, 2010 12:49AM UTC by john comment:3

resolution: → fixed
status: newclosed