Jignasa Naik
Filed under - JavaScript
5 Comments so far. Add yours now

You can use below function to parse query parameter in javascript:

function gup( name )
{
name = name.replace(/[[]/,”\[").replace(/[]]/,”\]”);
var regexS = “[\?&]“+name+”=([^&#]*)”;
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return “”;
else
return results[1];
}

Example:
http://www.domain.com/param=test
alert(gup( ‘param’ ));

Tags: ,

5 Responses


  1. Michael Robert Brown on 16 Sep 2012

    A very impressive article. Well prepared. Very motivating!! Go off on to facilitate way

  2. Stacy Williams on 23 Sep 2012

    Admiring the persistence you put into your site and in depth information you provide. It’s good to come across a blog every once in a while that isn’t the same outdated rehashed information. Wonderful read! I’ve bookmarked your site and I’m including your RSS feeds to my Google account.

  3. jignasa on 24 Sep 2012

    Thank you Michael and Stacy, yeah we are planning our blog as hub resources and it is not for SEO purpose. We will eventually post comment and tools handy for web development professionals. We also invite you to share your knowledge with us.

  4. about Dogs on 02 Oct 2012

    Hi, was just going through the google looking for good info and stumbled across your website. I am stunned at the design that you’ve on this site. It shows how you appreciate this subject.
    Welcome to my blog [url=http://www.about-dogs.zoomshare.com/]www.about-dogs.zoomshare.com[/url].

    • sagdubey on 02 Oct 2012

      Thank you for your valuable comment, and also we have visited your blog, it’s too informative.


Leave your comment

You must be logged in to post a comment.

Share IT © 2018. All rights reserved.