怎么获得json数据根据jsonid获得里面的内容

&script type="text/javascript"& &&&&&&& $(document).ready(function () { &&&&&&&&&&& getScatalog("paidang", "M06");
&&&&&&&& });
function getScatalog(selectid,BaseCode) { &&&&&&&&&& if (BaseCode != "") { &&&&&&&&&&&&&& $.ajax({ &&&&&&&&&&&&&&&&&& url: "ajax/getCatalogByBasecode.aspx", &&&&&&&&&&&&&&&&&& data: "code=" + encodeURI(BaseCode), cache: false, &&&&&&&&&&&&&&&&&& datatype: "html", &&&&&&&&&&&&&&&&&& success: function (context) { &&&&&&&&&&&&&&&&&&&&&& fillselect(selectid, context); &&&&&&&&&&&&&&&&&& } &&&&&&&&&&&&&& }); &&&&&&&&&& } &&&&&&&&&& else { &&&&&&&&&&&&&& return "Error"; &&&&&&&&&& } &&&&&& }
function fillselect(selectid, context) { &&&&&&&&&& var listitem=new Array(); &&&&&&&&&& listitem = eval(context); &&&&&&&&&& for (var i = 0; i & listitem. i++) { &&&&&&&&&&&&&& $("#" + selectid).append("&option value='" + listitem[i]["code"] + "'&" + listitem[i]["name"] + "&/option&");& //为Select追加一个Option(下拉项) &&&&&&&&&& } &&&&&& }
html代码:
&select id="paidang" class="selectstyle" name="paidang"& &&&&&&&&&&&&&&&&& &option value="" selected&==请选择==&/option& &&&&&&&&&&&&& &/select&
新建一个.aspx页面删除.aspx页面里的html代码删除,在.aspx.cs里添加如下代码
string rq_basecode= &&&&&& rq_basecode = Request.QueryString["code"]; &&&&&& if (string.IsNullOrWhiteSpace(rq_basecode)) &&&&&& { &&&&&&&&&& Response.Write("Error"); &&&&&&&&&& Response.End(); &&&&&& }
&&&&&& BLLCataLog bll_info = new BLLCataLog(); &&&&&& List&Scatalog& lt_info = new List&Scatalog&(); &&&&&& lt_info = bll_info.GetCatalog(rq_basecode,""); &&&&&& //Response.Write(rq_basecode); &&&&&& if (lt_info.Count & 0) &&&&&& { &&&&&&&&&& Response.Write(JsonHelper.ToJson(lt_info)); &&&&&& } &&&&&& else &&&&&& { &&&&&&&&&& Response.Write("Null"); &&&&&& }
BLL层的数据:
public List&M2Model.Scatalog& GetCatalog(string code, string refcode) &&&&&& { &&&&&&&&&& DALCataLog dalcatalog6 = new M2SharpDAL.DALCataLog(); &&&&&&&&&& return dalcatalog6.GetCatalog(code, refcode); &&&&&& }
阅读(...) 评论()

我要回帖

更多关于 jquery获得json数据 的文章

 

随机推荐