2

I am using this plugin: http://plugins.jquery.com/project/query-object

The 'get' and 'toString' methods work fine, but the 'set', 'empty', and 'remove' methods do not work. In the author's demonstration, he only uses 'get' and 'toString', but in his example on the top of the page, he uses the rest of the "nice-to-have" methods.

Anyone run into this before?

Thanks.

2 Answers 2

5

I tried the set method, and it works just fine:

alert($.query.set("section", 5).set("action", "do").toString());

Output:

?section=5&action=do
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for the response. I now understand that the functions just return the querystring. Is there a way to dynamically manipulate the querystring after the page has loaded?
@Andee: No, you can't change the query string of the current document, just as you can't change the URL. You can assign a new query string to the window.Location object, but that means that the page reloads.
3

Functions like .set return modified copy of original query-object. If you wish to modify existing object (for example one created using .load(string) method), use .SET method. Modifying of query string is possible now using HTML5: search for window.history.pushState(). Setting window.location.href variable will result in reloading page.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.