Note that there are some explanatory texts on larger screens.

plurals
  1. POJQuery form in div widthout refresh
    primarykey
    data
    text
    <p>I have some code: In an index.html-file I have a div</p> <pre><code>&lt;div id="logindiv"&gt; &lt;?php require_once('login.php'); ?&gt; &lt;/div&gt; </code></pre> <p>That is used with jquery</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function() { $.post('login.php', $('#login').serialize(), function ( data, textStatus) { $('#login').html(data); }); return false; }); &lt;/script&gt; </code></pre> <p>I want to put the login form into the div, so that the login works inside the div without the page refreshing. Also the redirect to other file (like you-are-logged-In.php) is displayed automaticaly in the div id=login.</p> <p>And login.php is</p> <pre><code>&lt;?PHP require_once("./include/membersite_config.php"); if(isset($_POST['submitted'])) { if($fgmembersite-&gt;Login()) { $fgmembersite-&gt;RedirectToURL("login-home.php"); } } ?&gt; &lt;div id='fg_membersite'&gt; &lt;form id='login' accept-charset='UTF-8'&gt; &lt;fieldset&gt; &lt;legend&gt;Login&lt;/legend&gt; &lt;input type='hidden' name='submitted' id='submitted' value='1'/&gt; &lt;div class='short_explanation'&gt;* required fields&lt;/div&gt; &lt;div&gt; &lt;span class='error'&gt; &lt;?php echo $fgmembersite-&gt;GetErrorMessage(); ?&gt; &lt;/span&gt; &lt;/div&gt; &lt;div class='container'&gt; &lt;label for='username' &gt;UserName*:&lt;/label&gt;&lt;br/&gt; &lt;input type='text' name='username' id='username' value='&lt;?php echo $fgmembersite-&gt;SafeDisplay('username') ?&gt;' maxlength="50" /&gt;&lt;br/&gt; &lt;span id='login_username_errorloc' class='error'&gt;&lt;/span&gt; &lt;/div&gt; &lt;div class='container'&gt; &lt;label for='password' &gt;Password*:&lt;/label&gt;&lt;br/&gt; &lt;input type='password' name='password' id='password' maxlength="50" /&gt;&lt;br/&gt; &lt;span id='login_password_errorloc' class='error'&gt;&lt;/span&gt; &lt;/div&gt; &lt;div class='container'&gt; &lt;input type='submit' name='Submit' value='Submit' onClick='loadLoginDiv();' /&gt; &lt;/div&gt; &lt;div class='short_explanation'&gt; &lt;a href='reset-pwd-req.php'&gt;Forgot Password?&lt;/a&gt; &lt;/div&gt; &lt;/fieldset&gt; &lt;/form&gt; &lt;!-- client-side Form Validations: Uses the excellent form validation script from JavaScript-coder.com--&gt; &lt;script type='text/javascript'&gt; // &lt;![CDATA[ var frmvalidator = new Validator("login"); frmvalidator.EnableOnPageErrorDisplay(); frmvalidator.EnableMsgsTogether(); frmvalidator.addValidation("username","req","Please provide your username"); frmvalidator.addValidation("password","req","Please provide the password"); // ]]&gt; &lt;/script&gt; &lt;/div&gt; </code></pre> <p>How to use the form without page refreshing? It submits once instead of many times without refreshing.</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.
 

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