标签:
1 后台: 2 List<Student> list=GetAll();//id name 3 string json = new JavaScriptSerializer().Serialize(list);//json格式字符串‘ 4 Response.Write(json); 5 前台js: 6 $.post(url, {}, function (text, status) { 7 var result = eval(text); 8 for (var i = 0; i < result.length; i++) { 9 //result[i].id; result[i].name;
10 $("#stu").append("<option value=‘" + result[i].id + "‘>" + result[i].name + "</option>");
11 }
}
C#返回Json,js解析Json,并添加到select标签中
标签:
原文地址:http://www.cnblogs.com/wanshi1989/p/4558760.html