Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. ajax/php issue

ajax/php issue

Scheduled Pinned Locked Moved JavaScript
javascripthelpcssphphtml
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RalfPeter
    wrote on last edited by
    #1

    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.

    html/js:

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>jQuery AJAX test form</title>
    <script src="js/jquery.min.js"></script>
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <script src="js/bootstrap.min.js"></script>
    </head>
    <body>
    <div class="container">
    <!-- Contacts -->
    <div id="contacts">
    <div class="row">
    <!-- Alignment -->
    <div class="col-sm-offset-3 col-sm-6">
    <p> </p>
    <p>Some header message here</p>
    <p> </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>
    </div>
    <div class="control-group">
    <div class="controls">
    <input type="email" class="form-control" placeholder="Email" id="email" required/>
    </div>
    </div>
    <div class="control-group">
    <div class="controls">
    <textarea rows="10" cols="100" class="form-control" placeholder="Message" id="message" style="resize:none"></textarea>
    </div>
    </div>
    <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"

    D 1 Reply Last reply
    0
    • R RalfPeter

      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.

      html/js:

      <!DOCTYPE html>
      <html lang="en">
      <head>
      <meta charset="utf-8">
      <title>jQuery AJAX test form</title>
      <script src="js/jquery.min.js"></script>
      <link href="css/bootstrap.min.css" rel="stylesheet">
      <script src="js/bootstrap.min.js"></script>
      </head>
      <body>
      <div class="container">
      <!-- Contacts -->
      <div id="contacts">
      <div class="row">
      <!-- Alignment -->
      <div class="col-sm-offset-3 col-sm-6">
      <p> </p>
      <p>Some header message here</p>
      <p> </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>
      </div>
      <div class="control-group">
      <div class="controls">
      <input type="email" class="form-control" placeholder="Email" id="email" required/>
      </div>
      </div>
      <div class="control-group">
      <div class="controls">
      <textarea rows="10" cols="100" class="form-control" placeholder="Message" id="message" style="resize:none"></textarea>
      </div>
      </div>
      <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"

      D Offline
      D Offline
      Dennis E White
      wrote on last edited by
      #2

      RalfPeter wrote:

      $("button#submit").click(function(event){

      Change your selector from...

      $("button#submit").

      to.

      $("#submit").

      R 1 Reply Last reply
      0
      • D Dennis E White

        RalfPeter wrote:

        $("button#submit").click(function(event){

        Change your selector from...

        $("button#submit").

        to.

        $("#submit").

        R Offline
        R Offline
        RalfPeter
        wrote on last edited by
        #3

        Nope. It now enters the ajax code, but does not access the php code. Thx for the tip.

        ralf.riedel@usm.edu

        D 1 Reply Last reply
        0
        • R RalfPeter

          Nope. It now enters the ajax code, but does not access the php code. Thx for the tip.

          ralf.riedel@usm.edu

          D Offline
          D Offline
          Dennis E White
          wrote on last edited by
          #4

          try debugging your error handler to see what is happening. I would change the error function to receive the three different parameters and then add a breakpoint on the error handler in whatever browser you are using.

          error: function(xhr, status, error){
              // checking the values returned should help diagnose the problem.
          }
          
          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups