【发布时间】:2011-03-08 16:00:51
【问题描述】:
我有一个 HTML 文档,它使用 AJAX 调用从 PHP 文件加载内容。我的代码的重要部分如下:
default.html:
/*more code above*/
var PHP_URL = "content.php";
var Content = document.getElementById('Content');
ajaxRequest = new XMLHttpRequest();
ajaxRequest.onreadystatechange =
function() {
if(ajaxRequest.readyState==4) {
if (ajaxRequest.status==200)
Content.innerHTML = ajaxRequest.responseText;
else
Content.innerHTML = "Error:<br/>unable to load page at <b>"+PHP_URL+"</b>";
Content.className = "Content Solid";
}
}
ajaxRequest.open("GET",PHP_URL,true);
ajaxRequest.send();
/*more code below*/
'content.php' 中的文件是否有可能检测到它是从'default.html' 调用的,或者根据需要从不同的调用文档调用?
【问题讨论】:
标签: php javascript html ajax