0
$('#show_mess').click(function (){
        $('#dropdown_mess').slideToggle("slow");
        $('#arrow_mess').slideToggle("slow");
        $('#arrow_not').hide("slow");
        $('#dropdown_not').hide("slow");

        function recall(){ setTimeout(function () {  

        xmlhttp = new XMLHttpRequest();

                xmlhttp.open("GET", "http://localhost/ajax/mess_data.php", true);

                xmlhttp.onreadystatechange = function () {

                        if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {

                                document.getElementById('dropdown_mess').innerHTML = xmlhttp.responseText;
                            }       
                    }

                xmlhttp.send();
                document.getElementById('dropdown_mess').innerHTML = "<img class='non_auto' id='ajax_loading' src='img/ajax_loading.gif'></img>";

                recall();

                }, 2000);
            }; 

                recall();
    });

此功能工作正常,但是当每个 ajax 调用完成后,我需要关闭并重新操作 chrome 才能工作,在 Firefox 中工作正常

4

1 回答 1

2

您已经在使用 Jquery 了,为什么不试试它的 ajax 函数,如下所示

$.ajax({
    url: "test.html",
    context: document.body
}).done(function() {
    ....
});

您可以在手册中找到更多信息

于 2013-09-29T14:06:52.550 回答