CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 2 of 2

Thread: Ajax/PHP issue

  1. #1
    Join Date
    Aug 2002
    Ocean Springs, MS

    Ajax/PHP issue

    Can someone please help me with this code by looking over it for something obvious? The problem seems to be that the embedded JavaScript code is not being executed and, therefore, the PHP code is also skipped. Both, the HTML and the PHP files are in the root directory.


    <div class="container"> 
      <!-- Contacts -->
      <div id="contacts">
        <div class="row"> 
          <!-- Alignment -->
          <div class="col-sm-offset-3 col-sm-6">
            <p>Some header message here</p>
            <form name="contact" class="well" id="contact">
              <legend>Contact Form</legend>
              <div class="control-group">
                <div class="controls">
                  <input type="text" class="form-control" placeholder="Name" id="name" />
                  <p class="help-block"></p>
              <div class="control-group">
                <div class="controls">
                  <input type="email" class="form-control" placeholder="Email" id="email" required/>
              <div class="control-group">
                <div class="controls">
                  <textarea rows="10" cols="100" class="form-control" placeholder="Message" id="message" style="resize:none"></textarea>
              <div id="success"> </div>
              <button type="submit" class="btn btn-primary pull-right" id="submit">Send</button>
              <button type="reset" class="btn btn-default pull-right" id="res">Reset</button>
              <br />
     $(function() {
                type: "POST",
                url: "process.php",
                data: $('').serialize(),
                success: function(){
                error: function(){

    PHP Code:
    if (isset($_POST['name'])) {
    $name strip_tags($_POST['name']);
    $email strip_tags($_POST['Email']);
    "Name      =".$name."</br>";   
    "Email     =".$email."</br>";  
    "Message       =".$message."</br>";    
    "<span class=\"label label-info\" >your message has been submitted .. Thank you</span>";
    Last edited by PeejAvery; August 28th, 2014 at 07:21 PM. Reason: Added proper BB tags for code.

  2. #2
    Join Date
    May 2002

    Re: Ajax/PHP issue

    Not sure what web browser you are using, but almost all have consoles to help with JavaScript debugging. I would highly suggest trying Firebug for Firefox to see what is failing.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

Tags for this Thread

Posting Permissions

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

Click Here to Expand Forum to Full Width