Skip to main content

Bug Tracker

Side navigation

#1638 closed bug (fixed)

Opened September 17, 2007 11:08AM UTC

Closed October 18, 2007 12:08AM UTC

Error migrating some $.ajax(...) calls to version 1.2.x (from versions 1.1.x)

Reported by: Piatenko Owned by:
Priority: major Milestone: 1.2.2
Component: ajax Version: 1.2.1
Keywords: Cc:
Blocked by: Blocking:
Description

Prior to version 1.2 it was ok to pass a Number data parameter to jQuery.ajax() function.

Example:

var i = 321;
$.ajax( { url: "/test.html", type:"POST", dataType:"json", data: i,
processData:false, success:function(r){alert(r)} } )

in new version I have to specify

data: i+""

to pass it as string parameter

var i = 321;
$.ajax( { url: "/test.html", type:"POST", dataType:"json", data: i+"",
processData:false, success:function(r){alert(r)} } )

and that's only because of this new line 2216 in code (v 1.2.1):

if ( s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre)) ) {

it could be easily fixed by adding only one additional condition

typeof s.data==="string" here:

if ( s.dataType == "json" && (s.data && typeof s.data==="string" && s.data.match(jsre) ||
s.url.match(jsre)) ) {
Attachments (0)
Change History (1)

Changed October 18, 2007 12:08AM UTC by john comment:1

milestone: 1.2.11.2.2
resolution: → fixed
status: newclosed
version: 1.21.2.1

Fixed in SVN rev [3670].