Note that there are some explanatory texts on larger screens.

plurals
  1. POjquery preventDefault() not working properly
    primarykey
    data
    text
    <p>I have this form and a javascript to do the fallowing: I need a user to submit an email address and after that the website should redirect him to another page. </p> <p>The issue is that event though my script seems to look correct when hitting submit, the page submits and sends a GET request to the server.</p> <p>The code:</p> <pre><code>&lt;form id="website"&gt; &lt;div id="new_website"&gt; &lt;div class="close_new_website"&gt;&lt;/div&gt; &lt;div class="websitemail"&gt;&lt;input type="text" name="webmail" /&gt;&lt;/div&gt; &lt;div class="websitesubmit"&gt;&lt;input type="submit" class="sendmail" value="Trimite" /&gt;&lt;/div&gt; &lt;script&gt; $(document).ready( function () { $("#website").submit(function(e){ e.preventDefault(); $.ajax({ type: 'POST', async: false, url: 'http://www.website.com/mailer/new_website.php', data: $("#website").serialize(), success: function(data) { console.log(data); //self.location="http://www.website.com/contest/"; }, error:function(){ console.log (data); } }); return false; }); $(".close_new_website").click(function(){ $("#new_website").fadeOut(); }); }); &lt;/script&gt; &lt;/div&gt; &lt;/form&gt; </code></pre> <p>I have looked through a lot of issues like this on the website so I do not want to waste your time.</p> <p>Thank you.</p> <p><strong>EDIT 1:</strong></p> <p>I have added this <code>console.log ('loaded');</code> right after the <code>$(document).ready( function () {</code> and it does not fire at all so I thought there should be a problem with Jquery therefore I added in front of everything this:</p> <pre><code>&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"&gt;&lt;/script&gt; </code></pre> <p>And it is still not working. </p> <p><em>I suppose the problem comes from the last Wordpress Update</em> or something since yesterday <code>jquery.min.map</code> was not found. I downloaded it and added it to its respective loading folder but still the problem persists.</p> <p><strong>EDIT 2:</strong></p> <p>I tried to replace Jquery 1.10.2 with 1.9.1 and 1.8.3 but still the same happens.</p>
    singulars
    1. This table or related slice is empty.
    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.
    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