gpt4 book ai didi

javascript - jQuery ajax data.d 未定义

转载 作者:行者123 更新时间:2023-11-29 18:07:57 32 4
gpt4 key购买 nike

我正在尝试使用 Ajax 调用获取 CRM 数据。返回的数据带有“d”和“结果”属性,但我无法在客户端获取它。它说 ajaxdata.d 未定义。

Ajax 调用示例:

var context = Xrm.Page.context;
var serverUrl = context.getClientUrl();
var ODATA_ENDPOINT = context.prependOrgName("/xRMServices/2011/OrganizationData.svc");

var filter = "?&$select=cc_TypeID,cc_customentityId,cc_anotherAttribute&$filter=cc_TypeID eq '2'";

var odataUri = ODATA_ENDPOINT + "/cc_customentitySet" + filter;

console.log("odataUri: " + odataUri);

//Asynchronous AJAX function to Retrieve a CRM record using OData
$.ajax({
type: "GET",
contentType: "application/json; charset=utf-8",
datatype: "json",
url: odataUri,
async: false,
beforeSend: function (XMLHttpRequest) {
//Specifying this header ensures that the results will be returned as JSON.
XMLHttpRequest.setRequestHeader("Accept", "application/json");
},
success: function (ajaxdata, textStatus, XmlHttpRequest) {
//console.log("cc_campaignSynch.htm > ready > $.ajax success: " + data);

debugger;

},
error: function (XmlHttpRequest, textStatus, errorThrown) {
console.log("cc_campaignSynch.htm > ready > $.ajax error: " + XmlHttpRequest.responseText);
}
});

返回的数据快照:

enter image description here

更新快照(使用 JSON.parse):

enter image description here

最佳答案

可能没什么,但尝试将“datatype”更改为“dataType”

关于javascript - jQuery ajax data.d 未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29918109/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com