Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jQuery Ajax不适用于IE 9或更早版本_Javascript_Jquery_Ajax_Internet Explorer_Internet Explorer 9 - Fatal编程技术网

Javascript jQuery Ajax不适用于IE 9或更早版本

Javascript jQuery Ajax不适用于IE 9或更早版本,javascript,jquery,ajax,internet-explorer,internet-explorer-9,Javascript,Jquery,Ajax,Internet Explorer,Internet Explorer 9,我将jQuery与ajax结合使用,它在除IE9或更早版本之外的所有浏览器中都能工作jQuery本身可以工作,但ajax调用不能。我使用以下代码: HTML: 我的代码有什么地方不能在IE9或更早版本中工作 更新 我试图最小化代码,以检查是否正确集成了jQuery。以下代码在IE 9或更低版本中仍然不起作用: <!doctype html> <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang

我将jQuery与ajax结合使用,它在除IE9或更早版本之外的所有浏览器中都能工作jQuery本身可以工作,但ajax调用不能。我使用以下代码:

HTML:

我的代码有什么地方不能在IE9或更早版本中工作

更新

我试图最小化代码,以检查是否正确集成了jQuery。以下代码在IE 9或更低版本中仍然不起作用:

<!doctype html>
<!--[if lt IE 7]>
<html class="no-js lt-ie9 lt-ie8 lt-ie7" lang=""> <![endif]--> <!--[if IE 7]>
<html class="no-js lt-ie9 lt-ie8" lang=""> <![endif]--> <!--[if IE 8]>
<html class="no-js lt-ie9" lang=""> <![endif]--> <!--[if gt IE 8]><!-->
<html class="no-js" lang=""> <!--<![endif]-->

<head>
    <meta title="Test">
</head>

<body>

<p id="test"></p>

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="assets/js/jquery-1.11.1.min.js.js"><\/script>')</script>

<script type="text/javascript">
    $.ajax({
        url: 'http://api.joind.in/v2.1/talks/10889',
        data: {
            format: 'json'
        },
        error: function () {
            $('#info').html('<p>An error has occurred</p>');
        },
        dataType: 'jsonp',
        success: function (data) {
            var $title = $('<h1>').text(data.talks[0].talk_title);
            var $description = $('<p>').text(data.talks[0].talk_description);
            $('#test')
                .append($title)
                .append($description);
        },
        type: 'GET'
    });
</script>

</body>

</html>

window.jQuery | | document.write(“”) $.ajax({ 网址:'http://api.joind.in/v2.1/talks/10889', 数据:{ 格式:“json” }, 错误:函数(){ $('#info').html('发生错误

'); }, 数据类型:“jsonp”, 成功:功能(数据){ var$title=$('').text(data.talks[0].talk\u title); var$description=$(“”).text(data.talks[0]。talk\u description); $(“#测试”) .append($title) .附加($说明); }, 键入:“获取” });

这段代码怎么了?

可能是Jquery加载不正确。 请尝试以下操作:

<!--[if lt IE 9]>  
    <script src="jquery-1.9.0.js"></script>  
<![endif]-->  
<!--[if (gte IE 9) | (!IE)]><!-->  
    <script src="jquery-2.0.0.js"></script>  
<!--<![endif]-->


另一个原因可能是jQuery/IE没有正确地对双引号进行URL编码,并显示在URL(“”)中,而不是编码的双引号(%22)

您使用的是哪个版本的jQuery?到底出了什么问题?您是否检查了开发人员控制台中的错误?“不工作”不是一个有用的问题描述。您在F12开发工具中看到了哪些错误?这些电话根本就没有完成吗?完成并调用
失败
?点燃你的电脑?@T.J.Crowder-我想这是最后一次了。它肯定着火了@多罗:你的例子在IE9中对我有效:我试过了,但这也不起作用。我已经更新了我的代码。我创建了一个测试文件。我文章末尾的代码在IE9或更低版本中仍然不起作用。
<!doctype html>
<!--[if lt IE 7]>
<html class="no-js lt-ie9 lt-ie8 lt-ie7" lang=""> <![endif]--> <!--[if IE 7]>
<html class="no-js lt-ie9 lt-ie8" lang=""> <![endif]--> <!--[if IE 8]>
<html class="no-js lt-ie9" lang=""> <![endif]--> <!--[if gt IE 8]><!-->
<html class="no-js" lang=""> <!--<![endif]-->

<head>
    <meta title="Test">
</head>

<body>

<p id="test"></p>

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="assets/js/jquery-1.11.1.min.js.js"><\/script>')</script>

<script type="text/javascript">
    $.ajax({
        url: 'http://api.joind.in/v2.1/talks/10889',
        data: {
            format: 'json'
        },
        error: function () {
            $('#info').html('<p>An error has occurred</p>');
        },
        dataType: 'jsonp',
        success: function (data) {
            var $title = $('<h1>').text(data.talks[0].talk_title);
            var $description = $('<p>').text(data.talks[0].talk_description);
            $('#test')
                .append($title)
                .append($description);
        },
        type: 'GET'
    });
</script>

</body>

</html>
<!--[if lt IE 9]>  
    <script src="jquery-1.9.0.js"></script>  
<![endif]-->  
<!--[if (gte IE 9) | (!IE)]><!-->  
    <script src="jquery-2.0.0.js"></script>  
<!--<![endif]-->