我已经尝试过这个作为上一个问题的答案,但它不起作用它只报告500内部服务器错误和Firebug没有报告错误的任何细节:
(function worker() {
$.ajax({
url: 'buildmarkers.inc.php',
type: 'POST',
success: function(data) {
$('.result').html(data);
},
complete: function() {
// Schedule the next request when the current one's complete
setTimeout(worker, 30000);
}
});
})();
当我这样尝试时,它正在运作:
<?php include('buildmarkers.inc.php')?>
答案 0 :(得分:0)
你真正的问题是,&#34;为什么我会收到500错误。&#34;如果没有buildmarkers.inc.php的代码,就无法确定答案。你没有在firebug中看到任何东西,因为它是服务器端错误。如果您修改了javascript并添加了错误功能,那么您将在客户端上看到它失败。
(function worker() {
$.ajax({
url: 'buildmarkers.inc.php',
type: 'POST',
success: function(data) {
$('.result').html(data);
},
error: function(data){
console.log("Save me Tom Cruise! The server is on fire!");
},
complete: function() {
// Schedule the next request when the current one's complete
setTimeout(worker, 30000);
}
});
})();
答案 1 :(得分:0)
Ajax调用将获取具有URI相对路径的文件(基于DOCUMENT_ROOT或webserver),它可能与使用当前脚本文件的绝对路径的PHP中的include()不同。你可以: