Note that there are some explanatory texts on larger screens.

plurals
  1. POcombo box value not returning
    primarykey
    data
    text
    <p>Below is my php file , there is a combobox with multiple options, on selection new menu should appear according to selection </p> <p>All the code is in single php file that is index.php </p> <p>I don't want to refresh the page or submit the value it should be done on selection/click</p> <p>My url look like this</p> <pre><code>http://localhost/lms/grade/report/userdef/index.php?id=13 </code></pre> <p>and in computer file is located at</p> <pre><code>C:\xampp\htdocs\lms\grade\report\userdef </code></pre> <p>it's just for clarification because jQuery need paths and stuff that I am not good with</p> <p>This is my code for combo boxes and selection</p> <pre><code>&lt;?php $change; if( isset($_GET['combo_1']) ) { echo $change = $_GET['combo_1']; } echo '&lt;select name="combo" id="combo_1"&gt;'; echo '&lt;option value="2"&gt;Submative&lt;/option&gt;'; echo '&lt;option value="1"&gt;formative&lt;/option&gt;'; echo '&lt;option value="3"&gt;successive&lt;/option&gt;'; echo '&lt;/select&gt;'; ?&gt; &lt;br&gt; &lt;?php if ($change==='1' or $change==='2') { $quizzes....// query for quezzes one echo '&lt;select id="combo_2"&gt;'; echo '&lt;option value=" " selected="selected"&gt;Choose....&lt;/option&gt;'; } foreach($quizzes as $id2 =&gt; $name) { echo '&lt;option value=' . $id2 . '&gt;' . $name . '&lt;/option&gt;'; } echo '&lt;/select&gt;'; } if ($change==='2') { quizzes2//query for quizes echo '&lt;select id="combo_3"&gt;'; echo '&lt;option value=" " selected="selected"&gt;Choose....&lt;/option&gt;'; foreach($quizzes2 as $id3 =&gt; $name2) { echo '&lt;option value=' . $id3 . '&gt;' . $name2 . '&lt;/option&gt;'; } echo '&lt;/select&gt;'; } if ($change==='3') { // another menu } //////more functionality </code></pre> <p>I am trying to return value selected using following javascript but nothing happens, its not returning the value</p> <p>All the code is in single file that is <code>index.php</code>:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function() { $('#combo_1').change(function(){ var combo_1 = $(this).val(); $.ajax({ type: 'GET', url: 'index.php', data: {'combo_1':combo_1}, success: function(data){ alert(data) } }); }); }); &lt;/script&gt; </code></pre>
    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.
    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