get queryString param


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

simple function to get querystring from a custom address using regular expression


Copy this code and paste it in your HTML
  1. // usage: getQueryValue("http://localhost-vm/site/default.aspx?123deds=122223&winner=carneiro0&deds=123", "deds") // returns 123
  2.  
  3. var getQueryValue = function(p_str, p_param){
  4. return (p_str ? p_str.match(new RegExp('(?:\\?|&|&)'+p_param+'=(.*?)(?:&|$)')) : [])[1];
  5. };

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.