SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard silver trophybronze trophy asp_funda's Avatar
    Join Date
    Jun 2003
    Location
    ether
    Posts
    4,497
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Lightbulb parsing querystrings through js?

    Hi everyone
    We all know that querystrings are generally parsed through server-side languages. But I want to do it through JavaScript, can anyone help? I know it can be done, though not as easily as through server-side langs.

    Ok, here's a url.
    http://www.sample.com/sample.html?id=5&mode=me&cat=20

    There are 3 variables in this --> id, mode & cat.
    Now, as far as I know, the querystring will be put in an array & from there it'll have to be split.

    Can anyone tell me how to parse it?

    Thanks in advance
    Our lives teach us who we are.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Me - Photo Blog - Personal Blog - Dev Blog
    iG:Syntax Hiliter -- Colourize your code in WordPress!!

  2. #2
    SitePoint Wizard silver trophy rushiku's Avatar
    Join Date
    Dec 2003
    Location
    A van down by the river
    Posts
    2,056
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    you can get the query with location.search...at least, you can in IE

    you'll get ?id=58&mode=me&cat=20

    As far as parsing it goes...String.split the query, then split the results into parallel arrays that the function getParameter() you're going to write can operate on.

  3. #3
    SitePoint Wizard silver trophy
    Join Date
    May 2003
    Posts
    1,843
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ::: certified wild guess :::


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
  •