wcf json asp.net json
function BindNewsTypeTree() {
var parentid;
//
$.getJSON(serviceUrl +
"NewsTypeService.svc/GetNewsTypeTreeJson?jsoncallback=?",
$.getJSON(serviceUrl + "NewsTypeService.aspx?jsoncallback=?",
{
siteID: siteID, isNewsType: true, fun: ‘GetNewsTypeTreeJson‘ },
function (data) {
// alert(data);
$(‘#treeNews‘).tree(‘loadData‘, $.parseJSON(data));
SetSelectedNode();
});
});
}
if
(!IsPostBack)
{
System.Collections.Specialized.NameValueCollection
querylist = Request.QueryString;
if (querylist ==
null)
{
Response.End();
}
else
{
string
fun = querylist["fun"];
string result = "";
if (fun ==
"GetNewsTypeTreeJson")
{
result =
ToJSON(GetNewsTypeTreeJson(C_int32(DG_keyVale(querylist, "siteID")),
C_bool(querylist["isNewsType"])));
}
else if (fun ==
"GetPageEntityList") {
result =
ToJSON(GetPageEntityList(C_int32(DG_keyVale(querylist, "siteID")),
C_int32(DG_keyVale(querylist, "parentID")), C_int32(DG_keyVale(querylist,
"pageIndex")), querylist["name"]));
}
else if (fun ==
"DeleteData") {
result =
ToJSON(DeleteData(C_int32(DG_keyVale(querylist, "siteID")),
C_int32(DG_keyVale(querylist, "id"))));
}
Response.Clear();
Response.ContentEncoding =
System.Text.Encoding.UTF8;
Response.ContentType =
"application/json";
if
(!string.IsNullOrEmpty(result))
{
if (querylist["jsoncallback"]
!= "")
{
JavaScriptSerializer jss = new
JavaScriptSerializer();
Response.Write((querylist["jsoncallback"] + "(" +
jss.Serialize(result) + ");"));//+
"\""这里要注意的
}
else
{
Response.Write(result);
}
}
Response.Flush();
Response.End();
}
}
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。