[英]jQuery ajax redirect issue
I am using the following script to to load pages of my site: 我正在使用以下脚本加载网站页面:
var xhr;
function Ajax(afile,adiv,arun,loader) {
// Loading info
if(loader==null) { gi("loaderdiv").style.display='inline'; }
// Process Ajax
var htm = afile.split('?');
var xhr = $.ajax({
type: "GET",
url: htm[0],
data: htm[1],
cache: false,
success: function(html){
gi("loaderdiv").style.display='none';
$(gi(adiv)).fadeIn(100);
$('#'+adiv).html(html);
}
});
// Set global process ID
window['xhr'] = xhr;
}
This script works fine - most of the time. 该脚本可以正常工作-大多数时候。 Unfortuntately it sometimes happens that the script will redirect to the link instead of loading it into the div. 不幸的是,有时脚本会重定向到链接,而不是将其加载到div中。 When that happens, the following script error occures: 发生这种情况时,会发生以下脚本错误:
attempt to run compile-and-go script on a cleared scope jquery.js line: 16 尝试在已清除作用域的jquery.js行上运行编译脚本:16
I really hope someone can help. 我真的希望有人能提供帮助。
Thank you 谢谢
It sounds like you might be rendering a script that is received from the page you are acquiring via ajax. 听起来您可能正在渲染从通过ajax获取的页面接收的脚本。
Try to put a breakpoint on the success function in your ajax request, and see what's coming back. 尝试在ajax请求中的成功函数上设置一个断点,然后查看返回的结果。 Look for javascript, or something that might cause the page to redirect... 寻找javascript或可能导致页面重定向的内容...
由于在facebook.php中缺少会话,Facebook正在进行重定向
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.