DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Ajax Post/URL Encoding Form values.

  1. #1
    Join Date
    Sep 2004
    Posts
    2

    Post Ajax Post/URL Encoding Form values.

    I'm trying to do an AJAX call transparently on a time in a PHP page.



    <snippet>
    START AJAX STUFF
    if(objHTTP != null)
    {
    var url = "./popup.php?m=/mytasks/do_cpdp&suppressheader=true";
    objHTTP.open("post", url , true);
    objHTTP.setRequestHeader("Content-type", "application/x-www-form urlencoded");
    objHTTP.setRequestHeader("Content-length", params.length);
    objHTTP.setRequestHeader("Connection", "close");
    objHTTP.send(params);
    objHTTP.onreadystatechange = setOutput;
    }


    var retText;
    function setOutput()
    {
    //alert(objHTTP.readyState);
    if(objHTTP.readyState == 4)
    {
    retText = objHTTP.responseXML;
    return retText;
    }
    }
    ---------------------------------------------------------
    Here's how the params variable kind of works:
    ---------------------------------------------------------
    There are quite a few fields in the form, so I'm iterating through the form controls and appending values to look like this"
    params = COMPANY='6'&
    EMPLOYEE='12'&
    OPS_ID='43'&
    DPS_ID='4815'&
    STATUS='1'&

    do I need to urlencode these paramaters?


    I don't have a debugger so I'm kind of flying blind as to whats happening on in backend server code..

    Thanks.

    Doug

  2. #2
    Join Date
    Mar 2007
    Location
    Bangalore, India
    Posts
    247
    Do you have problems with the existing code? You do not need the single quotes in the params. It should be just EMPLOYEE=12 and so on.

Similar Threads

  1. ajax in php question, form field population
    By vanillacraig in forum AJAX
    Replies: 1
    Last Post: 11-16-2007, 06:08 AM
  2. Form Values Unchanged
    By Faisal in forum ASP.NET
    Replies: 0
    Last Post: 03-08-2003, 05:59 AM
  3. html form values to xml
    By siva in forum XML
    Replies: 0
    Last Post: 11-02-2001, 12:51 AM
  4. Replies: 0
    Last Post: 10-30-2001, 01:34 AM
  5. losing Form values from option boxes
    By Paul Klanderud in forum ASP.NET
    Replies: 2
    Last Post: 07-26-2000, 10:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center