我正在尝试通过$.get
调用更新 div 的内容,但它失败了ie(9).
这js
是这个
function UpdateElementOfParent(box_id, page_ref, template_ref)
{
$.get("get_content.php", { box_id: box_id, page_ref: page_ref, template_ref:template_ref } )
.done(function(data) {
$('#'+box_id).html(data);
});
}
这get_content.php
是
<?php
include("connect.php");
$page_ref = $_GET['page_ref'];
$template_ref = $_GET['template_ref'];
$box_id = $_GET['box_id'];
$sql = mysql_query("SELECT * FROM site_content WHERE page_ref='$page_ref' AND template_ref='$template_ref' AND box_id='$box_id' AND box_type='text'");
while($row=mysql_fetch_array($sql))
{
echo stripslashes($row['content']);
}
?>
它工作正常firefox/chrome/safari and opera.
php更新了数据库但div ("#"+box_id)
没有更新ie
(只有ie9
手头所以不知道它是否只有9或其他版本)
任何线索?
快速更新
似乎 ie 正在缓存中保存来自先前 $.get 调用的一些数据。基本上我在屏幕上有一个 div,当用户单击一个按钮时,会打开一个带有可使用 nicedit 编辑的 textarea 的图层。textarea 填充了 $.get,然后用户单击保存,图层被隐藏,并且父页面上的原始 div 使用相同的 $.get 调用进行更新。
在ie中,如果我更改内容,db会更新但div不会更新,当我打开图层时,它仍然显示旧数据。
第一个 $.get 电话是这样的
$.get("get_content.php", { box_id: box_id, page_ref: page_ref, template_ref:template_ref } )
.done(function(data) {
document.getElementById("edit_content").value=data;
area1 = new nicEditor({fullPanel : true}).panelInstance("edit_content",{hasPanel : true});
});
警报数据不会在 IE 中显示更新的文本,因此它肯定与 $.get 调用有关