我想从后端带来Json对象的下拉列表格式。我的Json对象是跟随[{" Intid":1," Strkey":" Saving Deposits"},{" Intid":2 ," Strkey":"安全... [英] I Want To Dropdown Dropdown List Format Of Json Object I Brought From Backend ..My Json Object Is As Follows[{"Intid":1,"Strkey":"Saving Deposits"},{"Intid":2,"Strkey":"Security...
本文介绍了我想从后端带来Json对象的下拉列表格式。我的Json对象是跟随[{" Intid":1," Strkey":" Saving Deposits"},{" Intid":2 ," Strkey":"安全...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
$(function () {
$.ajax({
type: 'POST',
datatype: 'text',
url: '../../Controllers/PopulateList.ashx',
data:JSON.stringify(DropDown),
success: function (jsonList) {
alert("success");
var listItems= "";
$.each(jsonList, function(index,itemData) {
alert(itemData.intId);
alert(itemData.strKey);
listItems+= "<option value='" + itemData.intId + "'>" + itemData.strKey + "</option>";
});
// });
$("#SavAcc").html(listItems);
},
error: function (xhr, ajaxOptions, thrownError) {
alert('Error: ' + xhr.statusText);
},
processData: false,
async: false,
});
});
推荐答案
( function (){
.ajax({
type:' POST',
数据类型:' text',
url:' ../../ Controllers / PopulateList.ashx',
data: JSON .stringify(DropDown),
成功: function (jsonList){
alert( success);
var listItems = ;
.ajax({ type: 'POST', datatype: 'text', url: '../../Controllers/PopulateList.ashx', data:JSON.stringify(DropDown), success: function (jsonList) { alert("success"); var listItems= "";
.each(jso nList, function (index,itemData){
alert(itemData.intId);
alert(itemData.strKey);
listItems + = < option value =' + itemData.intId + '> + itemData.strKey + < / option>;
});
// });
.each(jsonList, function(index,itemData) { alert(itemData.intId); alert(itemData.strKey); listItems+= "<option value='" + itemData.intId + "'>" + itemData.strKey + "</option>"; }); // });
这篇关于我想从后端带来Json对象的下拉列表格式。我的Json对象是跟随[{" Intid":1," Strkey":" Saving Deposits"},{" Intid":2 ," Strkey":"安全...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文