Which is the preferable method of populating a <select> dropdown through one of jQuery’s $.ajax() methods? Is there is a significant performance benefit with either method?
- Return the new
<option>s as JSON and use$.each()to add them as<options>to a string, and then use$.html()to populate the<select> - Generate the HTML on the server side in the AJAX script, and just
$.load()the HTML into the<select>
I think the fastest way i the append function : http://api.jquery.com/append/