我找到了答案:
在RichText命令中。js文件中,我添加了以下脚本,用于将项目Sitecore ID发送到API:
function scInsertSitecoreLink(sender, returnValue) {
if (!returnValue) {
return;
}
var url = returnValue.url;
var itemId = url.substring(url.indexOf("=") + 1, url.lastIndexOf("&"));
var $ = jQuery.noConflict();
$.ajax({
async: true,
type: "GET",
url: '/sitecore/api/Test/ThisIsTheTestApiCall',
data: JSON.stringify(itemId),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (result) {
alert(result);
}
});
[...]
}
-
首先,我添加了var$=jQuery。无冲突();在ajax调用之前;
更多信息请点击此处:
https://api.jquery.com/jquery.noconflict/
-
然后我检查了路由是否有任何更改:registerhtproutes;
-
利润