gpt4 book ai didi

jquery - Internet Explorer 不执行 jQuery.load (Firefox 执行)

转载 作者:行者123 更新时间:2023-12-01 01:09:47 24 4
gpt4 key购买 nike

我正在尝试制作一个非常简单的 CMS 系统,到目前为止一切顺利。但现在,当我尝试将编辑页面加载到 div (.load - jQuery) 时,IE 不会显示它,而 Firefox 会显示。

这是我的加载代码

function edit_item(id){
$('#row_'+id).load("actions/edit.php?id="+id, function(response, status, xhr) {
if (status == "error") {
var msg = "Sorry but there was an error: ";
$('#row_'+id).html(msg + xhr.status + " " + xhr.statusText);
}
});
}

这是我正在尝试加载的页面

<?php
include('connect.php');
$item = resultset;
?>
<script>
$(function() {
$("#datepicker").datepicker();
$("#datepicker").datepicker("option", "dateFormat", "yy-mm-dd");
var currentdate = $("#currentdate").val()
$("#datepicker").datepicker('setDate', currentdate);

});
</script>
<form method="POST" action="actions/update.php">
<input type="hidden" id="currentdate" value="<?=$item['datum']?>">
<table style="border: 1px solid black; margin-left: 10px; width: 620px;">
<tbody>
<tr>
<td>Titel</td>
<td><input type="text" name="titel" class="input" style="width: 560px;" value="<?=$item['titel']?>"></td>
</tr>
<tr>
<td>Datum</td>
<td><input type="text" name="datum" class="input" id="datepicker" style="width: 560px;"></td>
</tr>
<tr>
<td>Bericht</td>
<td><textarea name="inhoud" class="input" style="width: 560px; height: 300px;"><?=$item['inhoud']?></textarea></td>
</tr>
<tr>
<td>Foto's</td>
<td>
<input type="file" name="foto[]">
<input type="file" name="foto[]">
<input type="file" name="foto[]">
<input type="file" name="foto[]">
<input type="file" name="foto[]">
<input type="file" name="foto[]">
</td>
</tr>
<tr>
<td colspan="2"><input type="submit" id="toevoegen" value="Updaten" class="input" style="float:right; margin-right: 5px; margin-top: 5px;"></td>
</tr>
</tbody>
</table>
<input type="hidden" name="id" value="<?=$_GET['id']?>">
<input type="hidden" name="aktie" value="item">
</form>

Internet Explorer 给我这个错误:

Sorry but there was an error: 0 Error: Could not complete the operation due to error c00ce56e.

解决方案: header('Content-Type: text/html; charset=UTF-8'); 可以解决问题,但 IE 已将其缓存。当我清除它时 - 它再次开始工作,所以谢谢!

最佳答案

谷歌搜索错误代码似乎表明问题在于 XHR 响应的编码。

If you set encoding headers for XMLHttpRequests to header(‘Content-Type’ , ‘text/html; charset=utf8‘); instead of header(‘Content-Type’, ‘text/html; charset=UTF-8‘); IE7 will give the nice and clear error c00ce56e.

参见:http://blog.shpare.com/2008/03/04/error-c00ce56e-in-ie/

关于jquery - Internet Explorer 不执行 jQuery.load (Firefox 执行),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8962795/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com