Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jQuery.param.querystring (build url) should use recursive merge (aka. deep copy). #35

Open
Asgaroth opened this issue Jan 12, 2012 · 0 comments

Comments

@Asgaroth
Copy link

jQuery.param.querystring (build url) does not currently merge params acordinly when using array typed queryStrings

Assume an URL like this:

var url = "?Obj[attr1]=a&Obj[attr2]=b";

If we wish to merge a data object like

var data = { Obj : { attr3 : c } };

we (or me) would expect the result from jQuery.param.querystring (url, data) to be:

"?Obj[attr1]=a&Obj[attr2]=b&Obj[attr3]=c"

But instead we get:

"?Obj[attr3]=c"

This is because when calling $.extend on jquery.bb-bbq.js at line 281, simple, and not recursive, merge is used

To solve this, the line should look like:
: $.extend( true, {}, url_params, params ); // passed params override url params

which solves the issue and returns the expected url.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant