How to implement something like PHP's http_build_query and the reverse in javascript?

Posted by wamp on Stack Overflow See other posts from Stack Overflow or by wamp
Published on 2010-06-03T02:30:38Z Indexed on 2010/06/03 2:34 UTC
Read the original article Hit count: 233

Filed under:
|
<?php
$data = array('foo'=>'bar',
              'baz'=>'boom',
              'cow'=>'milk',
              'php'=>'hypertext processor');

echo http_build_query($data);
/* Output:
      foo=bar&baz=boom&cow=milk&php=hypertext+processor
*/

How to do similar thing in javascript,say, get the query string from the array ,and convert the array to query string?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about web-development