且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

填充基于使用AJAX JSON的另一个下拉列表中的下拉列表

更新时间:2023-01-07 21:01:56

现在的问题是,你是不是循环和响应列表中添加所有的项目都选择标签的选项

The problem is that you are not looping and adding all the items on the response list to the options of the select tag

request.done(function(json_return){    
                //alert(json_return['grade_desc']);
                **$( "#grade" ).append( "<option>"+json_return['grade_desc']</option>"**     );
            });

的突出部分应当修正为所有的值都被添加作为选择,像

The highlighted portion should be corrected so as all the values are being added as options, something like

var options = '';

for (i=0;i< json_return['grade_desc'].length;i++){
   options += "<option>"+json_return['grade_desc'][i]+"</option>";
}
$("#grade").append(options);

第二个问题,需要更多的信息。请张贴从阿贾克斯响应的一个片段。

The second question needs more information. Please post a snippet of the response from ajax.