我有一个调用 WCF 服务的 jQuery Ajax 函数。服务调用成功:
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 响应字符串是使用 fiddler 填充的,如何提取 json 响应中返回的值?我想将值存储在 javascript 中的列表或数组中。感谢您对此的任何建议。