Populate select box
Populate select box
Hello everybody,
I am trying to populate a select box with the help of jquery php and mysql.
Goal is to let the user select a province which then returns a select box with coresponding cities.
Now I am stuck. Here is what I am doing:
On select of province I pass the name via jquery to a php script that queries the db and from there on I am lost. I am able to alert the data via alert($data); But how could I now populate the select field?
Here is the code I am using:
-
function load_area($id){
$.ajax({
type: \'POST\',
url: \'/subapp_inserate/act_search_box.php\',
data: \'pid=\'+$id,
success: function(data){
//alert whatever PHP script outputs
alert(data);
}
});
}
Thank you for any hint you might have.
Merlin