SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Dec 2011
    Posts
    221
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    multiple variable is parameters

    hi there! i'm a new bee. I'm having problem sending two data here.
    Code:
                            parameters = 'text='+document.getElementById('text').value && 'text2='+document.getElementById('text2').value;
    			xmlhttp.open('POST', 'try.php', true);
    			xmlhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
    			xmlhttp.send(parameters);
    text and text2 are my textboxes, but only text2 show its value.

  2. #2
    SitePoint Addict
    Join Date
    Dec 2005
    Posts
    336
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Code JavaScript:
    parameters = 'text='+document.getElementById('text').value + '&text2='+document.getElementById('text2').value;
    Replace the && with a + and add a &


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
  •