【发布时间】:2018-12-12 20:15:59
【问题描述】:
我想通过 AJAX 在我的 div 中加载一个 iFrame。我该怎么做?
<button id="iframeload">Load Iframe</button>
<div id="iframe_content"></div>
<script src="http://code.jquery.com/jquery-1.12.4.min.js"></script>
<script type="text/javascript">
$('.iframeload').click(function(event) {
event.preventDefault();
event.stopImmediatePropagation();
$.ajax({
type: "POST",
url : "https://pecom.ru/ru/calc/?iframe=Y",
success : function (data) {
// alert('ok');
$("#iframe_content").html(data);
}
});
});
</script>
这是 iFrame
<iframe id="pecom-kabinet-iframe" allowtransparency="true" frameborder="0" width="800" height="1800" scrolling="auto" style="border: 0;" src="https://pecom.ru/ru/calc/?iframe=Y">Not supported browser< / iframe >
并且按钮#iframeload 不起作用...
【问题讨论】:
-
为什么是 iframe?你能不能不使用 div 而只是将响应附加到那个?
标签: javascript jquery html ajax iframe