SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Nov 2011
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,939
    Mentioned
    215 Post(s)
    Tagged
    12 Thread(s)
    Hi,

    Just so I'm sure that I understood your question correctly, could you post a short example of what you are trying to achieve.
    i.e. the code you have and what you would like the output to be.

  3. #3
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,705
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by kieran82 View Post
    Get the search parameters in href url address after the ?
    window.location.search provides that information for you.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  4. #4
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,939
    Mentioned
    215 Post(s)
    Tagged
    12 Thread(s)
    Quote Originally Posted by paul_wilkins View Post
    window.location.search provides that information for you.
    I was going to write this, too, but the OP's original question mentions hrefs:

    Quote Originally Posted by kieran82
    Get the search parameters in href url address after the ?
    which made me think he might be trying to parse all the links on a page (for example) and attach some kind of behaviour to them.


Bookmarks

Posting Permissions

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