This article mainly introduces jQuery's method of obtaining json data when selecting a drop-down list. it mainly involves the use of the getJSON method in jQuery, for more information about how to obtain json data from jQuery in the drop-down list, see the following example. Share it with you 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 help you with jQuery programming.