The example in this article describes how jQuery implements the method of obtaining json data when selecting from a drop-down list. Share it with everyone for your reference. The details are as follows:
function populateDropDown() { $.getJSON('/getData.aspx',{Name:$('#parm').val()},function(data){ var select = $('#DDLControl'); var options = select.attr('options'); $('option', select).remove(); $.each(data, function(index, array) { options[options.length] = new Option(array['variety']); }); }); } $(document).ready(function() { populateDropDown(); $('#DDLchangeData').change(function() { populateDropDown(); }); });
I hope this article will be helpful to everyone’s jQuery programming.