Populating select option using php -


i have select option load categories mysql using php, need when user choose value category select, select option appears , populates products of category. 2 select should in same form because need pass selected category , selected product when submitting form.

<select name='test1' id='test1'>     <option value='1'>1</option>     <option value='2'>3</option>     <option value='3'>3</option>     <option value='4'>4</option> </select> 

html

<select name='tes2' id='test2'> </select> 

ajax

$("#test1").on('change',function(){ $.ajax({  url : 'someurl',  data: { data },  datatype: 'json',  async: false,  success: function(res){  //populate second select  } }); }); 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -