我有一個調用WCF服務的jQuery Ajax函數。服務調用成功:提取JSON響應值
function WCFJSON() {
var now = new Date();
var getFromDate = dateToWcf(new Date(now - (60000 * 1440)));
var userid = "1";
m_Type = "POST";
m_Url = "https://dev-04.boldgroup.int/ManitouDashboard/DashboardProxyService.svc/GetStats"
m_Data = '{"getFromDate": "' + getFromDate + '", "getValueList": [1, 2, 3, 7]}';
m_DataType = "json";
m_ProcessData = true;
CallService();
}
function CallService() {
$.ajax({
type: m_Type, //GET or POST or PUT or DELETE verb
url: m_Url, //Location of the service
data: m_Data,
dataType: m_DataType, //Expected data format from server
processdata: m_ProcessData, //True or False
crossdomain: true,
contentType: "application/json",
success: function (msg) { //On Successfull service call
ServiceSucceeded(msg);
},
error: function (jqXHR, textStatus, errorThrown) {
ServiceFailed("jqXHT: " + jqXHR.result + "Text Status: " + textStatus + " Error Thrown: " + errorThrown);
} // When Service call fails
});
}
,我可以看到原始的JSON響應字符串使用招填充,我該如何提取JSON響應返回的值?我想要獲取值存儲在一個列表或一個數組中的JavaScript。感謝您的任何建議。
返回的JSON是什麼樣的? – Ryan
{「GetStatsResult」:[{「Key」:2,「Value」:[{「StatDateTime」:「\/Date(1346448742000-0600)\ /」,「Value」:「0」},{「 : 「\ /日期(1346448747000-0600)\ /」, 「值」: 「0」} – CodeMan5000