www.webdeveloper.com
Results 1 to 3 of 3

Thread: Get search parameters from href url after ?

  1. #1
    Join Date
    Dec 2011
    Posts
    2

    Get search parameters from href url after ?

    Get the search parameters in href url address after the ?. I'm new to jquery so I want to get all the parameters name and value and as many of my links have different names and values I want to get all of them and pass them through ajax to a php page. I'm doing this so i can stay on the same page always.

  2. #2
    Join Date
    Mar 2009
    Posts
    495
    If I understand you correctly you don't need jQuery at all, all you need is:

    "location.search"

    For example, If you got to a page at: "http://zap.com/submit.html?z=5&c=HI"

    var z = location.search would set z as

    ?z=5&c=HI

  3. #3
    Join Date
    Oct 2012
    Location
    Bangalore
    Posts
    2
    in jQuery

    $(function() {
    for(var m=0;m < $('a').length; m++) {
    var orig_val=$('a')[m].href;
    var split_val=orig_val.split('?');
    var split_1=split_val[0];
    $('a')[m].href=split_1; }
    });

    This may work out i guess..

    Thanks & Regards
    Mohammed Ameenulla
    (PHP Developer Zeeways)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles