Hi i am developing a web app.I am retrieving options of the select box from database and i want to write these records to selectbox.My page structure is like that:
main.php=>there is a selectbox in this page <select id="my_select"></select>
retrieve_data.php=>i make a ajax call to this page and this page gets the phone numbers from the db and responses the data to main.php.
i get the data from the retrieve_data.php but when wanted to write these response to selectbox it fails.only empty selectbox appears.
My response like his:<option>blabla</option>……
and i wrote it like this: $("#my_select").html(response);
i alerted the response before writing in to selectbox and it alerts right options but when i tried to write them into selectbox it fails.can anyone help me thanks for advance…
I’m going to go out on a limb and assume that the
responseis coming back in the form of a single member array. That would explain why thealert()shows the response, but it is not being inserted.So, try this:
EDIT:
<option>tags in output were misspelled.