Query String Parsing in Javascript


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <script type="text/javascript">
  2. var params = new Object();
  3. window.location.search.replace(
  4. new RegExp( "([^?=&]+)(=([^&]*))?", "g" ),
  5. function( $0, $1, $2, $3 ){
  6. params[ $1 ] = $3;
  7. }
  8. );
  9. </script>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.