I am currently working on a php project with the user of ajax. I need to populate values from a database into an html drop down box and I want to do this from an ajax post.
For all the other ajax so far in the project I have been using $.post but I do not need to post anything to the php script as it is just going to retrieve everything from the database. what I need to do is the php script retrieves the information from a database and populates the information into an array and then return the array to the calling php script that calls that ajax.
Is the array idea the best idea, if so how do I get the contents of the array from the ajax, or is there a better way and how do I do the ajax call if I am not doing a post of anything.
Thanks for any help you can provide.
The easiest way to do what you’re describing is using JSON with your jQuery Ajax request, like so: