SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Guru D-flyer's Avatar
    Join Date
    Jan 2001
    Location
    Near a computer
    Posts
    782
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to submit a form in an Ajax div???

    Hi,

    I have loaded a form in an Ajax div, but now the simple submit doesn't work

    Any tips/tutorials or good advice??

  2. #2
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by D-flyer View Post

    Any tips/tutorials or good advice??
    Use Firefox's JavaScript console to find errors. Google "ajax tutorial" for tutorials.

  3. #3
    SitePoint Guru D-flyer's Avatar
    Join Date
    Jan 2001
    Location
    Near a computer
    Posts
    782
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    tx pepejeria,

    In fact I use firebug (might be useful for someone else)

    At the moment i have a working ajax form but with the 'pesky' GET.

    Still struggling to enable POST

  4. #4
    SitePoint Guru D-flyer's Avatar
    Join Date
    Jan 2001
    Location
    Near a computer
    Posts
    782
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmm,
    ok i think i am almost there.

    I think i need to use
    Code:
    function makeRequestForm(url, parameters, layerName)
    {
    .......
            http_request.open('POST', url, true);
            http_request.send(parameters);
    }
    but what's the proper way to send the parameters

    Code:
    var queryString = "name=" + naam + "&job=" + job+ "&email=" + email;
    makeRequestForm("form.php", queryString, 'content');
    doesn't seems to work???

  5. #5
    SitePoint Guru D-flyer's Avatar
    Join Date
    Jan 2001
    Location
    Near a computer
    Posts
    782
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok I think I found a solution by adding
    Code:
    	http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    	http_request.setRequestHeader("Content-length", parameters.length);
    	http_request.setRequestHeader("Connection", "close");

  6. #6
    SitePoint Guru D-flyer's Avatar
    Join Date
    Jan 2001
    Location
    Near a computer
    Posts
    782
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok another little problem

    I have add a captcha and now the form isn't working. I guess it has to do with $_SESSION

    Code:
    if($_POST['Submit']) 
    { 
       if(($_SESSION['keycode'] == $_POST['check_code']) && (!empty($_SESSION['keycode'])) )
    ....
    .....
    and the keycode
    Code:
    $keycode = keygen(6);
    $_SESSION['keycode'] = $keycode;
    Any advice on using $_SESSION + $_POST and httpRequest???

    SOLVED
    Last edited by D-flyer; Apr 7, 2007 at 04:11.


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
  •