Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Issue with ajax.....simple...

    Ok so i'm new to this ajax thing and I don't understand why this isn't working. It is supposed to submit a form to a php script by POST and clear the form. It isn't sending the data. The form id is QuestionForm. Any ideas....?

    PHP Code:
    <script type="text/javascript" 
        
    src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>  
        <script>
              function SubmitQuestion(){
                  
                  var $form = $('#QuestionForm');
                  var Answers = $form.serialize();
                  request = $.ajax({
                        url: "SubmitQuestion.php",
                      type: "POST",
                       data: Answers
                    });              
              }
              document.getElementById('QuestionForm').reset();
          </script> 

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,630
    Thanks
    6
    Thanked 1,002 Times in 975 Posts
    Is the element you are addressing even existing when the script is executed? Where in your document is that code?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •