$(document).ready(除非刷新,否则函数不加载

| 我正在使用jQuery和$(document).ready事件。当我在IE8中加载时,出现错误“对象不支持此属性或方法”。当我刷新时,它工作正常。这是我的代码:
    <script language=\"text/javascript\">
    $(document).ready(function ()
    {
        var xmlhttp;
        xmlhttp=new XMLHttpRequest();
        xmlhttp.onreadystatechange=function()
       {
     if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
       document.getElementById(\"loginbox\").innerHTML=xmlhttp.responseText;
       }
    }
        xmlhttp.open(\"POST\",\"loginform.php\",true);
       xmlhttp.setRequestHeader(\"Content-type\",\"application/x-www-form-urlencoded\");
       xmlhttp.send();
   });
  </script>
我的头标签中有以下内容:
    <script type=\"text/javascript\" src=\"http://code.jquery.com/jquery-latest.js\">
任何帮助将不胜感激,我已经尝试过$(window).load和其他。     
已邀请:
        包括它时,请使用jQuery库,因为仅使用
$(document).ready()
函数。 尝试以下代码(它完成与您完全相同的操作):
$(document).ready(function() {
  $.post(\'loginform.php\', $(\'#id_of_your_login_form\').serialize(), function(response) {
    $(\'#loginbox\').html(response);
  });
});
此行也可能有问题:
<script language=\"text/javascript\">
您指定的是
type
,而不是
language
。尝试以下一项:
<script type=\"text/javascript\">
    

要回复问题请先登录注册