capture querystring with javascript

Results 1 to 2 of 2

Thread: capture querystring with javascript

  1. #1
    DontWorry Guest

    Default capture querystring with javascript

    How do you get the contents of querystring parse it in javascript?<BR>Can you interact asp and javascript?<BR>

  2. #2
    Harish Babu.N Guest

    Default RE: capture querystring with javascript

    hi u can use javascript function<BR><BR>function getParams() {<BR>var idx = document.URL.indexOf(&#039?&#039);<BR>var params = new Array();<BR>if (idx != -1) {<BR>var pairs = document.URL.substring(idx+1, document.URL.length).split(&#039&&#039);<BR>for (var i=0; i&#060;pairs.length; i++) {<BR>nameVal = pairs[i].split(&#039=&#039);<BR>params[nameVal[0]] = nameVal[1];<BR> }<BR>}<BR>return params;<BR>}<BR>params = getParams();<BR><BR><BR>Now the params array contains the values passed as query string<BR>Access the array to get query string values<BR><BR><BR>one way to interact between java script and ASP is through HTML<BR>i.e send values from javascript to html(like hidden input) and access from ASP or vice versa<BR>-Hope this helps<BR><BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts