SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 2007
    Posts
    89
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How I can access POST and GET

    How I can access POST and GET values with javascript
    in PHP is $_GET and $_POST

    but in Javascript
    Searched everywhere. I could not find

  2. #2
    SitePoint Addict
    Join Date
    Dec 2007
    Posts
    207
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code snippet I once wrote that will retrieve GET data.

    Code JavaScript:
    var lh = location.href.split('?')[1].split('&');
    var get = new Array();
     
    for (var i = 0; lh[i]; i++) {
    	get[lh[i].split('=')[0]] = lh[i].split('=')[1];
    }

    Than you can do something like alert(get['id']);

  3. #3
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    You can parse the querystring but you can't do much with post.

  4. #4
    SitePoint Enthusiast
    Join Date
    Dec 2007
    Posts
    89
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    yup

    Ok thanks.Let me check whether it works..

  5. #5
    SitePoint Enthusiast
    Join Date
    Dec 2007
    Posts
    89
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ok then

    Will Parsing makes me to post further..


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
  •