Javascript 从“获取异常消息”;增加了“项目”;jqueryajaxcal中的事件接收器
我正在使用REST和Ajax调用更新列表项(Asyn:True)。 更新后会触发事件接收器。 Ajax调用将一直等待,直到接收器完成,但如果事件接收器中存在任何异常,我希望在Ajax错误函数中看到异常。 可能吗Javascript 从“获取异常消息”;增加了“项目”;jqueryajaxcal中的事件接收器,javascript,jquery,ajax,rest,sharepoint-2010,Javascript,Jquery,Ajax,Rest,Sharepoint 2010,我正在使用REST和Ajax调用更新列表项(Asyn:True)。 更新后会触发事件接收器。 Ajax调用将一直等待,直到接收器完成,但如果事件接收器中存在任何异常,我希望在Ajax错误函数中看到异常。 可能吗 ajax({ url: restSource, type: "POST", async: true, contentType: "application/json;odata=verbose", data: JSON.stringify({
ajax({
url: restSource,
type: "POST",
async: true,
contentType: "application/json;odata=verbose",
data: JSON.stringify({
'__metadata': { 'type': 'SP.ListItem' }, 'Columns1': 'Value'
}),
headers: {
"Accept": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val(),
"X-HTTP-Method": "MERGE",
"If-Match": "*"
},
success: function (data) {
waitDialog.close();
},
error: function (data) {
alert("Something went wrong")
//Want to read the exception from event receiver.
}
您的警报不包含结束语句<代码>警报(“出错”)应使用分号there@Vasim可以看看自动插入分号。代码很好,karteek可以在错误函数中尝试console.log(data)…@Jonasw谢谢,我不知道。