IE8中的jQuery .ajax和.appendTo

时间:2013-11-12 06:00:53

标签: jquery internet-explorer internet-explorer-8 cross-browser

在各种浏览器中打开以下页面时,我看到了奇怪的行为:

<html>
    <head>

        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
        <script>
            $(document).ready(function() {
                $.ajax({
                        url: "http://development.collegian.com/2013/06/27/newspaper-racks-looking-thin-on-campus/",
                        cache: false,
                        success: function(result) {
                            var test = $($.parseHTML(result));
                            test.appendTo("body");
                        }
                });
            });
        </script>
    </head>
    <body>
        Test.
    </body>
</html>

这在Firefox和IE10中按预期工作(加载指定的URL),但是当我在IE开发人员工具中打开IE8浏览器模式和IE8标准时,AJAX页面无法加载。 IE中没有错误。

感谢您的帮助!

1 个答案:

答案 0 :(得分:0)

in ie 8写完整网址

url: "http://development.collegian.com/2013/06/27/newspaper-racks-looking-thin-on-campus/index.php(or any full page name(home.html/home.php)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^set your file name here

因为在IE较低版本中需要完整网址