$.ajax({
type: "POST",
url: "PGmain.ashx",
data: "action=DisplaySummarys",
//dataType:"json",
success: function(response, status, xhr){
if(response == "error")
{
alert("DisplaySummarys失败!!");
}
else
{
eval('var tmp = ' + response);
$.each(tmp.totle,function(i,n){
alert(n.first);
});
//alert(response);
}
}
type: "POST",
url: "PGmain.ashx",
data: "action=DisplaySummarys",
//dataType:"json",
success: function(response, status, xhr){
if(response == "error")
{
alert("DisplaySummarys失败!!");
}
else
{
eval('var tmp = ' + response);
$.each(tmp.totle,function(i,n){
alert(n.first);
});
//alert(response);
}
}
});
// eval('var tmp=' + response);
后台组织:
string json = "{\"summarys\":[";
foreach (string key in DataBufMgr.ms_mapStatueCache.Keys)
{
json += "{\"first\":";
RXGmc2Cockpit_ServerStatus newObj = (RXGmc2Cockpit_ServerStatus)DataBufMgr.ms_mapStatueCache[key]["summary"];
string summary = newObj.szHtml;
json += "\"" + key + "\"" ;
json += "},";
}
json = json.Substring(0, json.Length-1);
json += "]}";
return json;