Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>For starters you can clean up your code a bit. See if this helps (tested and its working)</p> <p>JS File</p> <pre><code>function loadMulti () { var num_to_enter = 2;//$('#num_to_enter').val(); $.ajax({ type: "POST", url: "temp.php", data: "num_to_enter=" + num_to_enter, }).done (function (data){ //success is deprecated $("#test").html (data); }); return false; } $(document).ready (function (){ loadMulti (); }); </code></pre> <p>Or maybe you want a js post??</p> <pre><code>function loadMulti () { var num_to_enter = 2;//$('#num_to_enter').val(); $ ("#check").on ("click", function (){ $.ajax({ type: "POST", url: "temp.php", data: "num_to_enter=" + num_to_enter, }).done (function (data){ //success is deprecated $("#test").html (data); }); }); return false; } $(document).ready (function (){ loadMulti (); }); </code></pre> <p>PHP File</p> <pre><code>&lt;?php $num_to_enter = $_POST["num_to_enter"]; $string = ""; echo $num_to_enter; $i=1; while ($i &lt;= $num_to_enter) { $string .= "The html form here repeated by {$num_to_enter}&lt;br/&gt;"; $i++; } ?&gt; &lt;span class="red"&gt;Fields With Red Asterisks * Are Required&lt;/span&gt; &lt;?php echo $string; ?&gt; </code></pre> <p>PHP File that makes the call.</p> <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;&lt;/title&gt; &lt;script src="http://code.jquery.com/jquery-1.10.2.min.js"&gt;&lt;/script&gt; &lt;script src='test.js'&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="test"&gt;test&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>or with the post</p> <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;&lt;/title&gt; &lt;script src="http://code.jquery.com/jquery-1.10.2.min.js"&gt;&lt;/script&gt; &lt;script src='test.js'&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="test"&gt;results will show here.&lt;/div&gt; &lt;form class="my_form" name="addReg" id="addReg" method="post" /&gt; &lt;input id="check" type="button" name="sendpost" value="Get Data"&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><strong>EDIT:</strong> Added the php file that makes the call, I changed the .load () to .html () with its respected selector.</p> <p>Also I am not sure if you wanted the message to print out more then once, so if you need it printed that way just change $string to an array.</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. VO
      singulars
      1. This table or related slice is empty.
    2. 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