Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>On initial page load: The process flow looks like this:</p> <blockquote> <p>Server Side code -> sends data to client -> browser begins rendering and executing JS</p> </blockquote> <p>On form Submit:</p> <blockquote> <p>Client Executes code (javascript) -> Sends data to server -> Server gets data and processes</p> </blockquote> <p>to change the way this works you would want to do an <a href="http://api.jquery.com/jQuery.ajax/" rel="nofollow">ajax</a> or <a href="http://api.jquery.com/jQuery.post/" rel="nofollow">post</a> form submit and on "success" then execute the above JavaScript. You can post to the same page or change it to a RESTful service.</p> <p>Here are examples of AJAX and POST functions from jQuery:</p> <h2>AJAX</h2> <pre><code>$.ajax({ type: "POST", url: url, data: data, success: success, dataType: dataType }); </code></pre> <h2>POST (JS)</h2> <pre><code>$.post('ajax/test.html', function(data) { $('.result').html(data); }); </code></pre> <hr> <p>Here is the <strong>result specifically for you</strong>, taking the two snippets above.</p> <h2>JavaScript/jQuery</h2> <pre><code>$(function () { if ($('form').length &gt; 0) { $('form').submit(function (e) { e.preventDefault(); $.ajax({ type: "POST", url: "YOUR-URL", data: YOUR - FORM - DATA, success: function (result) { //result will contain the xml or JSON result of calling the FORM var check = "&lt;?php echo $studentID; ?&gt;"; alert(check); if (check != "") { alert("This user already exists"); return false; } else { return true; } }, dataType: "XML-OR-JSON" }); }); } }) </code></pre>
    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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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