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

发布于 2024-12-28 08:47:49 字数 2826 浏览 0 评论 0原文

我正在尝试制作一个非常简单的 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 给出了此错误:

抱歉,出现错误:0 错误:无法完成 由于错误 c00ce56e 导致操作。

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

I am trying to make an really simple CMS system, so far so good.
But now when I'm trying to load an editing page into a div (.load - jQuery) IE doesn't display it, Firefox does.

Here is my loading code

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);
      }
    });
}

And here's the page I am trying to load

<?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 is giving me this error:

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

Solution: header('Content-Type: text/html; charset=UTF-8'); was doing the trick, however IE had it cached. When I cleared it - it started working again so thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一指流沙 2025-01-04 08:47:49

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

如果将 XMLHttpRequest 的编码标头设置为 header('Content-Type' , 'text/html; charset=utf8');而不是 header('Content-Type', 'text/html; charset=UTF-8'); IE7 将给出漂亮且清晰的错误 c00ce56e。

请参阅:http://blog.shpare.com/2008/ 03/04/错误-c00ce56e-in-ie/

Googling the error code seems to suggest the problem is the encoding of the XHR response.

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.

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

﹏半生如梦愿梦如真 2025-01-04 08:47:49

从版本 2.6 开始,MSXML 通过 Mlang.dll 将所有 XML 文档传递给
验证它们的编码。如果Mlang.dll遇到非标准编码
字符串,它返回一个错误。

“ISO8859_1”是 Latin-1 字符的规范表示
Java 语言和类库中的编码字符串。标准
这是由互联网号码分配机构定义的,但是,
是“ISO-8859-1”,这不是可接受的别名。

http://support.microsoft.com/kb/304625

检查内容类型的字符集。

As of version 2.6, MSXML passes all XML documents through Mlang.dll to
verify their encoding. If Mlang.dll encounters a non-standard encoding
string, it returns an error.

"ISO8859_1" is the canonical representation of the Latin-1 character
encoding string in the Java language and class libraries. The standard
that is defined by the Internet Assigned Numbers Authority, however,
is "ISO-8859-1", which is not an accepted alias.

http://support.microsoft.com/kb/304625

Check you content-type's charset.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文