Copyright ©

Prototype parseQuery() Method

previous next


This method parses a URI-like query string and returns an object composed of parameter/value pairs. This method is similar to toQueryParams();

This method is realy targeted at parsing query strings (hence the default value of "&" for the separator argument).


string.parseQuery([separator = '&']);

Return Value:


<title>Prototype examples</title>
<script type="text/javascript" 

function showResult(){

  var str = "";
  var obj = str.parseQuery();

  alert ( "obj.section :  " + obj.section );
  alert ( " :  " + );

  var str = "tag=ruby%20on%20rails";
  var obj = str.parseQuery();
  alert ( "obj.tag:  " + obj.tag );




  <p>Click the button to see the result.</p>
  <br />
  <br />
  <input type="button" value="Result" onclick="showResult();"/>


To understand it in better way you can Try it yourself.

previous next

Copyright ©