I have three dropdowns I am trying to dynamically populate when an HTML form loads. They all use API callback functions provided by a third-party cloud database provider to retrieve the data and populate the dropdowns. The problem I am encountering is that only the last one populates. Here is how I'm calling the functions:
$(function ()
{
PopulateDropdown('OwnerList');
});
$(function()
{
PopulateDropdown('ClientList');
});
$(function ()
{
PopulateDropdown('AssignedToList');
});
The text inside the parentheses are the IDs of the dropdowns (select elements) in the HTML.
The only dropdown that ever gets populated is whichever the last one in the list is. The code as shown above populates only the AssignedToList dropdown. If I move the call to populate the AssignedToList to the top, moving the ClientList to the bottom, only the ClientList dropdown populates. I am fairly new to JavaScript and jQuery, so I'm sure there's a way to ensure all three calls work properly. I have Googled everything I can think of but haven't been able to find anything to help. I'm not even real sure what it is I need to Google! Any help would be greatly appreciated!
PopulateDropdown()function. Post it too...