Possible Duplicate:
querystring encoding of a javascript object
I'm trying to make a request to a website and embed the result as an iframe
in the page using javascript. I need to pass a number of parameters in the request as querystring variables and I'd like to be able to specify the parameters as an object, passing them to a function to produce a querystring so they are easy to read, maintain and manipulate.
How can I construct the querystring of a URL from a JSON object with simple values? I would expect this example:
{
h:300,
w:300,
skip:500,
count:50
}
to produce the following querystring:
h=300&w=300&skip=500&count=50
Are there any existing library functions to do this, or is the best thing to loop over the properties myself?