Note that there are some explanatory texts on larger screens.

plurals
  1. POInsert jQuery UI Dialog Modal Form data into mySQL
    text
    copied!<p>I'm using the jQuery UI Dialog for the registration of new users on my website. The dialog works fine. However, when I submit the form the AJAX call isn't doing anything. I've searched the web for a while but I can't find a working solution. This is my code at the moment:</p> <pre><code>var username=$("#username").val(); var password=$("#password").val(); var checkpassword=$("#checkpassword").val(); var email=$("#email").val(); var user_level=$("#user_level").val(); var date_created=$("#date_created").val(); $( "#dialog-form" ).dialog({ autoOpen: false, height: 500, width: 600, modal: true, buttons: { "Registreren": function() { var bValid = true; allFields.removeClass( "ui-state-error" ); bValid = bValid &amp;&amp; checkLength( username, "username", 3, 16 ); bValid = bValid &amp;&amp; checkLength( email, "email", 6, 80 ); bValid = bValid &amp;&amp; checkLength( password, "password", 4, 16 ); bValid = bValid &amp;&amp; checkLength( checkpassword, "checkpassword", 4, 16 ); bValid = bValid &amp;&amp; checkLength( user_level, "user_level", 0, 2 ); bValid = bValid &amp;&amp; checkRegexp( username, /^[a-z]([0-9a-z_])+$/i, "error" ); bValid = bValid &amp;&amp; checkRegexp( email, "error"); bValid = bValid &amp;&amp; checkRegexp( password, /^([0-9a-zA-Z])+$/, "error" ); bValid = bValid &amp;&amp; checkRegexp( checkpassword, /^([0-9a-zA-Z])+$/, "error" ); if ( bValid ) { $.post({ url: 'register.php', data: { username: username, password: password, checkpassword: checkpassword, email: email, user_level: user_level, date_created: date_created }//end data })//end AJAX post }//End if }//End function }//end buttons });//end dialog </code></pre> <p>My form is just a simple HTML input form with the specified ID's</p> <p>Ex input username:</p> <pre><code>&lt;form name="registeracc" id="registeracc" action="register.php" method="post"&gt; &lt;input required type="text" id="username" name="username" class="text ui-widget-content ui-corner-all" /&gt; &lt;/form&gt; </code></pre> <p>I've found several "fixes" for this problem on the web, but they dont seem to work for me.</p> <p>Ex:</p> <pre><code>data: $('#registeracc :input').serialize(), error: function(xml, status, error) { $('#registeracc').html('&lt;p&gt;???&lt;/p&gt;'); </code></pre>
 

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