JavaScript 'GET'

Discussion in 'JavaScript' started by T0PS3O, May 9, 2006.

  1. #1
    I'm creating an eBay listing template and want an 'ask a question' link in there. This link requires the item id (iid) and it would defeat the purpose of a template if its inserted manually.

    So... Can JavaScript sniff out the listing ID from the URL, or from the HTML above the snippet?

    I only ever used PHP with $_GET['variable'] - does JavaScript have a similar structure available?
     
    T0PS3O, May 9, 2006 IP
  2. Slapyo

    Slapyo Well-Known Member

    Messages:
    266
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    108
    #2
    You might want to check this out.

    http://adamv.com/dev/javascript/querystring

    Provides a nice method for accessing the query string of a page, or of one that you pass to it. It splits the query string up into name/value pairs for you.
     
    Slapyo, May 9, 2006 IP
  3. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks!

    Though I only just now realized how the eBay URL looks like:

    .co.uk/item_name_listing_title_here_W0QQitemZ9589355026QQcategoryZ45107QQtcZphotoQQcmdZViewItem

    Without a ?key=value&key2=value2 it's probably not going to be easy... I'll check out the link though, thanks a lot.
     
    T0PS3O, May 9, 2006 IP