Friday, August 31, 2012

Get query string values in JavaScript

Is there a plugin-less way of retrieving query string values via jQuery (or without)?

If so, how, and if not what plugin do you recommend?
You don't need jQuery for that purpose you can use the pure JavaScript

function getParameterByName(name)
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(;
if(results == null)
return "";
return decodeURIComponent(results[1].replace(/\+/g, " "));

Cheers ! 
Hope you got the Ans ! 
still having probs ? let me know by comments ! 

Know More About :



  1. this is such a nice and useful information for us...i appreciate urs word.......WordPress Development


  2. I actually enjoyed reading through this posting.Many thanks.

    Wordpress Development India


Any Questions or Suggestions ?


Professional & Experienced Freelance Developer From India, Technologist, Software Engineer, internet marketer and Open Sources Developer with experience in Finance, Telecoms and the Media. Contact Me for freelancing projects.

Enter your email address:

Delivered by FeedBurner

PHP Freelancer India - Google+