【发布时间】:2020-06-04 10:29:31
【问题描述】:
我有一个页面index.php 正在使用javascript 将test.php 动态加载到div 元素<div id="overlay_popup"></div> 中:
function load_php_content(PHP_PAGE) {
console.log("load_php_content : "+PHP_PAGE);
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("overlay_popup").innerHTML = this.responseText;
}
};
xmlhttp.open("GET",PHP_PAGE ,true);
xmlhttp.send();
}
并加载例如:
load_php_content("test.php?var=1");
test.php 页面包含一些似乎失败的 React 代码。 (反应元素没有出现。)
但是当我直接在浏览器的页面中加载页面时,页面运行良好(将 php 服务器发送的确切 url/行复制到动态 JS)。
因为它是动态生成的,所以没有 JS 日志让我找出问题的根源。
1 - 如果可能的话,你知道我在哪里可以阅读这个动态加载页面的 js“错误/警告”吗?
2 - React 有什么东西会导致这种类型的问题吗?
【问题讨论】:
标签: javascript reactjs browser