I have a html table with +- 50 rows ( generated from a DB ), and each row will have three unique drop down lists ( each drop down the options are from different table in the db )
How do I go about populating them with ajax. I know how to populate and build one but can you advise on the concept of many.
Do I use one ajax call the posts to a handler.ashx that uses one sql statement to retrieve all three tables data and then put it into a json object – then the jquery builds it all up from there?
Or do I use three separate ajax calls and three sql statements? but this I don’t think is possible as the in the loops the ajax wont wait for the data to come be fetched?
Can you please advise on the best solution or a tutorial or and idea/concept?
I agree with markpsmith, you should probably try to populate the dropdown lists on the server side, but if you really want to populate them on the Client Side, here is an example of how that can be done with AJAX. Keep in mind that the example doesn’t register the events for validation though. That’s an entirely different matter that you will have to address…
Page Code
Service Code
Result Screenshot