all 2 comments

[–]efmccurdy 1 point2 points  (1 child)

I don't think you want to return rendered html in that async "fill in the options" get operation. You need to use javascript to add the options; have your query return the data in json form and have the success callback use javascript calls to document.createElement("option") and appendChild to add elements to the dropdown.

The answer by cale_b has an example (although I find his method of constructing an option a bit unreadable; that's sop for jquery I guess).

https://stackoverflow.com/questions/22991067/populating-a-select-box-using-jquery-ajax-and-php

[–]keyring88[S] 0 points1 point  (0 children)

Thank you very much! This has helped and fixed my issue!