Skip to content Skip to sidebar Skip to footer

Updating Select/option Elements Value Using AJAX/PHP/SQL

Little background, I have a two dynamic select/option drop down which is echoed from PHP using sql queries. If first drop box is selected the second drop box will contain informat

Solution 1:

Use key value pair inside send function

 hr.send("val="+val);

And for now use sub_cat to append option tag

  document.getElementById("sub_cat").innerHTML = return_data;

And then add first option also before return_data

As you are not sending any key here, this below code will always fail and not go to if block

 if(isset($_POST['val'])){

Post a Comment for "Updating Select/option Elements Value Using AJAX/PHP/SQL"