考虑这个例子,test.php
:
<?php
if (array_key_exists("QUERY_STRING", $_SERVER)) {
if ($_SERVER["QUERY_STRING"] == "getone") {
echo "<!doctype html>
<html>
AAA
</html>
";
exit;
}
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<style type="text/css">
.my_btn { background-color:yellow; }
</style>
<script src="http://code.jquery.com/jquery-1.12.4.min.js"></script>
<script type="text/javascript">
var thishref = window.location.href.slice(0, window.location.href.indexOf('?')+1);
var qstr = window.location.href.slice(window.location.href.indexOf('?')+1);
function OnGetdata(inbtn) {
console.log("OnGetdata; loading ?getone via AJAX call");
$.ajax({url: thishref + "?getone",
async: true,
success: function(data) {
console.log("got getone data "); //, data);
//~ $("#dataholder").html(data); // for <div> only
$("#dataholder")[0].contentDocument.write(data);
},
error: function(xhr, ajaxOptions, thrownError) {
console.log("getone error " + thishref + " : " + xhr.status + " / " + thrownError);
}
});
}
ondocready = function() {
$("#getdatabtn").click(function(){
OnGetdata(this);
});
}
$(document).ready(ondocready);
</script>
</head>
<body>
<h1>Hello World!</h1>
<button type="button" id="getdatabtn" class="my_btn">Get Data!</button>
<iframe id="dataholder" src="about:blank" width="100%"></iframe>
</body>
</html>
我运行PHP&gt; 5.4作为与test.php
在同一目录中的服务器:
php -S localhost:8080
然后我在Firefox(43和46)中加载http://localhost:8080/test.php
。当我点击&#34;获取数据&#34;按钮,iframe的HTML被检索并正确分配,但是:
...如屏幕截图所示,&#34;正在连接......&#34;在Firefox中的选项卡上激活微调器,并且永远不会完成旋转。我已经尝试使用内置的浏览器控制台和Firebug进行检查,并且没有列出未完成的网络连接,即它们都报告为已完成(通常,当此微调器可见时,还会列出未完成的网络连接。网络电话)。
编辑:以下是内置网络标签显示的内容:
我希望在加载iframe的内容后,微调器就会消失,但事实并非如此。我做错了什么,如果加载iframe内容后如何让微调器消失?