Skip to main content

Bug Tracker

Side navigation

#5797 closed bug (wontfix)

Opened January 13, 2010 10:07PM UTC

Closed October 24, 2010 04:39PM UTC

AJAX 'data' is processed differently in 1.3 versus 1.4rc1

Reported by: TurnWheel Owned by:
Priority: major Milestone: 1.4
Component: ajax Version: 1.4
Keywords: ajax, ajax.data, backwards compatible Cc:
Blocked by: Blocking:
Description

Current Version: 1.4rc1

Previous Version: 1.3.2

This is basically just a backwards compatibility problem. On some of my apps I had a particular issue with the AJAX request when I upgraded. The 'data' option was processed differently in 1.3.2 vs. 1.4rc1.

Test Code

var dataObj = {
    'box[]' : [['box1',false],['box2',true]],
    'side' : true
};

$.ajax({
    url: 'post.php',
    type: 'POST',
    data: dataObj,
    processData: true
});

The resulting query string passed to 'post.php' is different on 1.3.2 versus 1.4rc1. Here are the results from my tests:

// Version 1.3.2
box[] = box1,false
box[] = box2,true
side = true
// Version 1.4rc1
box[][0][] = box1
box[][0][] = false
box[][1][] = box2
box[][1][] = true
side = true

This change has affected a small subset of some of my projects, and was easily fixed by turning processData off and processing the object manually (which isn't difficult). However, for the sake of backwards compatibility, it might be a good idea to have this feature function the same across the board, or at least accurately document the changes made for 1.4.

Thanks!

Attachments (0)
Change History (2)

Changed January 14, 2010 09:36PM UTC by TurnWheel comment:1

After some digging into the documentation, I found this can be fixed by turning on "traditional" param serialization. This was not something that was obviously changed in 1.4. It would be beneficial if the param serialization changes were clearly defined in the $.ajax documentation page, as this affects more than just the $.param functionality.

Thanks!

Changed October 24, 2010 04:39PM UTC by addyosmani comment:2

resolution: → wontfix
status: newclosed

I've made a note of this for our API documentation review and we may end up emphasizing it there further. For now, as we have mentioned the need to use the 'traditional' param for this purpose previously I'll be closing this ticket.