Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing href in jquery with get method
    primarykey
    data
    text
    <p>i´m learning jquery and i have a question.</p> <p>On html, when i want to pass variables by get, i write:</p> <pre><code>$subject=$_GET['subject']; $id_user=$_GET['id_user']; $id_pupil=$_GET['id_pupil']; &lt;a href='process.php?subject=".$subject."&amp;&amp; id_user=".$id_user." &amp;&amp; id_pupil=".$id_pupil."'&gt;Add&lt;/a&gt; </code></pre> <p>But i want to do it on Jquery. My idea is:</p> <p>I have this part of code:</p> <pre><code>while ($row = mysql_fetch_array($result)) { echo "&lt;tr&gt;&lt;form action='update_marks.php' method='post'&gt; &lt;td&gt;&lt;input type='text' name='mark' value='".$row['mark']."'&gt;&lt;/td&gt; &lt;td&gt;".$row['date']."&lt;/td&gt; &lt;td&gt;&lt;input type='submit' value='Update'&gt;&lt;/td&gt; &lt;input type='hidden' name='id_mark' id='id_mark' value='".$row['id_mark']."'&gt; &lt;input type='hidden' name='subject' id='subject' value='".$subject."'&gt; &lt;input type='hidden' name='id_user' id='id_user' value='".$id_user."'&gt; &lt;input type='hidden' name='id_pupil' id='id_pupil' value='".$id_pupil."'&gt; &lt;/form&gt; &lt;/tr&gt;"; echo "&lt;br&gt;"; } echo "&lt;/table&gt;"; echo "&lt;input type='button' id='add' value='Add row' /&gt;"; </code></pre> <p>And i would like to add rows in the table on Jquery:</p> <pre><code>$(document).ready(function(){ var subj=$('#subject').val(); var id_us=$('#id_user').val(); var id_pup=$('#id_pupil').val(); $("#add").on('click', function(){ $('#table &gt; tbody:last').after("&lt;tr&gt;&lt;td&gt;&lt;input type='text' name='mark' value=''&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;a href='add_mark.php?subject=subj &amp;&amp; id_user=id_us &amp;&amp; id_pupil=id_pup'&gt;Add row&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;"); }); </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.
 

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