For the problem from the background to get the JSON data, fill the content to the Drop-down list, the code is very simple, the specific process see the code below.
Requirements:URL: Link par:id sel: dropdown list Selector
Get Drop-down List
function buildselectbox (URL, par, sel) {
$ (SEL). empty ();
$.getjson (URL, {id:par}, function (JSON, textstatus) {for
(var i = json.length-1; I >= 0; i--) {
$ (SEL). P Repend (' <option value= ' + json[i]. Id + ' > ' + json[i]. Name + ' </option> ')
};
$ (SEL). prepend (' <option value= 0 "> select </option>)
});
}
The above code is very simple, this problem is easy to solve.
Jquery uses Ajax to get the JSON data page process returned by the background
For the implementation process, see the following code example:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">