2012-01-22 30 views
3

我想做一个非常简单的CMS系统,迄今为止很好。 但是现在,当我试图将编辑页面加载到div.load - jQuery)时,IE浏览器不显示它,Firefox会。Internet Explorer不执行jQuery.load(火狐浏览器)

这里是我的代码加载

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');正在做的伎俩,howeve IE已经缓存了。当我清除它 - 它再次开始工作,所以谢谢!

+0

我喜欢亲爱的StackOver(鲜花) – defau1t

+0

请在下面发布您的解决方案,然后接受您自己的答案。这是在回答自己的问题时使用本网站的最合适的方式。 – Sparky

+0

另外,我看到@ BenP的帖子导致回答。你应该加强他并接受他(他还需要改进他的答案)。 – Mrchief

回答

4

使用谷歌搜索错误代码似乎表明问题是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/

+1

假设您对社区不熟悉,请参阅以下提示以改善您的答案:1)不要用问题回答问题。 :) 2)添加一些代码片段/建议到你的答案。你可以引用它,如“这篇文章中所述......”,但不要将它们发送到另一个链接。如果你遵循这些提示,我相信你会得到更多的赞赏。 – Mrchief

+0

@Mrchief,是个好主意。我会改善这个答案,但我不确定它会帮助我们接受/接受 - 我已经收到Delano de Rooij的一封(现在已删除的)回复,表示我的回复没有帮助。 :) –

1

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

检查您内容类型的字符集。

相关问题