简体   繁体   English

Ajax jQuery在IE6上不起作用

[英]Ajax jquery not work on IE6

I'm working with ajax jquery. 我正在使用ajax jQuery。 Follow code work fine with all browser except IE6. 遵循代码在IE6以外的所有浏览器上均可正常运行。 I tried to change something but it doesn't work. 我试图更改某些内容,但是没有用。

Please help me to fix that! 请帮我解决这个问题! Thanks 谢谢

$(document).ready(function(){
    $("#form_get").submit(function(){
        var hasError = false,
        inputURL = $("#input_link").val();
        $('#form_get input').attr('disabled', true);
        $("#result_file h3").html('Loading ...');
        $("#result_text").html('<div style="text-align:center;"><img src="./images/lightbox-ico-loading.gif" /></div>');
        $("#result_file").slideDown('slow');
        var request = $.ajax({
            url: "get.php",
            type: "POST",
            data: {input_link : inputURL},
            dataType: "html",
            cache: false,
            timeout: 10000,
        });
        request.done(function(msg) {
            var aResult = JSON.parse(msg);
            $('#result_file h3').html(aResult.status);
            $("#result_text").fadeTo('slow',0,function(){
                $('#result_text').html(aResult.text);
                $("#result_text").fadeTo('slow',1);
            });
        });
        request.fail(function(jqXHR, textStatus) {
            alert('Ajax Error');
            $('#result_file h3').html('Error');
            $("#result_text").html("Ajax doesn't work");
        });
        $('#form_get input').attr('disabled', false);
    return false;
    });
});

Try removing the extra comma in this part of the code: 尝试删除此部分代码中的多余逗号:

var request = $.ajax({
    url: "get.php",
    type: "POST",
    data: {input_link : inputURL},
    dataType: "html",
    cache: false,
    timeout: 10000, //Remove this comma
});

So it should look like: 所以它应该看起来像:

$(document).ready(function(){
    $("#form_get").submit(function(){
        var hasError = false,
        inputURL = $("#input_link").val();
        $('#form_get input').attr('disabled', true);
        $("#result_file h3").html('Loading ...');
        $("#result_text").html('<div style="text-align:center;"><img src="./images/lightbox-ico-loading.gif" /></div>');
        $("#result_file").slideDown('slow');
        var request = $.ajax({
            url: "get.php",
            type: "POST",
            data: {input_link : inputURL},
            dataType: "html",
            cache: false,
            timeout: 10000
        });
        request.done(function(msg) {
            var aResult = JSON.parse(msg);
            $('#result_file h3').html(aResult.status);
            $("#result_text").fadeTo('slow',0,function(){
                $('#result_text').html(aResult.text);
                $("#result_text").fadeTo('slow',1);
            });
        });
        request.fail(function(jqXHR, textStatus) {
            alert('Ajax Error');
            $('#result_file h3').html('Error');
            $("#result_text").html("Ajax doesn't work");
        });
        $('#form_get input').attr('disabled', false);
    return false;
    });
});

BTW a good html,css,javascript editor would pick up this syntax issue for you. 顺便说一句,一个好的html,css,javascript编辑器将为您解决此语法问题。 I prefer to use Aptana 2.0. 我更喜欢使用Aptana 2.0。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM