function moveIt(result, finish) {
$result = $(result);
$result.find('#main-content-wrapper').appendTo('#aem-content');
$result.appendTo('#scriptDiv');
if (finish !== undefined) {
finish();
}
}
function isAuthSpace(path) {
if (path.toLowerCase().indexOf("shop/") > 0) return true;
return false;
}
function finishInjecting() {
ProcessInjection("div.dyna-prd-lnk", parseDivTag, pumpDivTag, "Shop.aspx/GetLinks");
}
function AEMLoadError(isAuth) {
var fileToLoad = "unAuth.html";
if (isAuth) {
fileToLoad = "auth.html";
}
$("#aem-content").load(fileToLoad, finishInjecting);
}
function breakAEMLoadPath(path) {
return BreakTheAEMLoadPath === true ? "2" : path;
}
function PullAEM(path, finish) {
var isAuth = isAuthSpace(path);
var ppath = breakAEMLoadPath(path);
$.ajax({
url: ppath,
success: function (result) {
moveIt(result, finish);
},
error: function () {
AEMLoadError(isAuth);
},
dataType: "html"
});
}当我调用上面的函数PullAEM( path,finish)时,不管我在path参数中输入了什么值,ajax调用都会调用成功函数,如果路径中有垃圾,就说它是空的,那么调用就会成功(即使它应该失败)。当它失败时,结果包含当前页面的内容,而不是路径所指向的内容。有人知道我做错了什么吗?
发布于 2015-10-16 22:17:12
感谢大家这么快回答。我不确定问题出在哪里,但在我把它清理干净并把它贴在这里之后,它工作得很好!不过,这可能是你们俩都在说的话。
它工作得很好……
https://stackoverflow.com/questions/33172196
复制相似问题