Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery ajax done and fail not fireing
    primarykey
    data
    text
    <p>I have the following ajax call: </p> <pre><code>$( document ).ready(function() { $( "#fform" ).submit(function( event ) { //alert( "Handler for .submit() called." ); event.preventDefault(); $.ajax({ type: "POST", url: "apply.php", data: "email="+$("#emaill").val() }) .done(function( msg ) { alert( "Data Saved: " + msg ); }).fail(function() { alert("Sorry. Server unavailable. "); }); }); }); </code></pre> <p>and in apply.php:</p> <pre><code>$con=mysqli_connect("some_server","some_usename","some_pass","some_db"); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $r=mysqli_query($con,"INSERT INTO some_table (email, join_date) VALUES ('".$_POST['email']."', CURDATE() )"); if($r) { echo 'true'; } else { echo 'false'; } mysqli_close($con); </code></pre> <p>The wierd thing is that I get the email in the DB but I'm not getting any alert! please help!</p> <p>UPDATE:</p> <p>The form:</p> <pre><code>&lt;form method="POST" id="fform" &gt; &lt;fieldset class="clearfixx" style="width: 552px; height: 40px;"&gt; &lt;div class="lp-pom-form-field clearfixx" style="width: 552px; height: 42px; top: 0px;"&gt; &lt;input placeholder="Email Address" type="email" id="emaill" name="email" class="textt" style="top: 0px; left: 58px; width: 520px; font-size: 15px; height: 38px; padding-left: 11px; padding-right: 11px; lineheight: 15px;" required&gt; &lt;/div&gt; &lt;/fieldset&gt; &lt;input type="submit" class="lp-element lp-pom-button" id="lp-pom-button-25" value="Submit dude"/&gt; &lt;/form&gt; </code></pre> <p>I get the data on DB after clicking the submit button but I don't get any alerts. Thank you</p> <p>UPDATE 2:</p> <p>error: Uncaught TypeError: Object # has no method 'done' </p> <p>SOLVED </p> <p>I was using an old version of JQuery thank you all</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload