为什么不';第二次和第三次调用后,t ajax load()工作


Why doesn't ajax load() work after second and third call?

我一直在尝试获得我的三个更新,当我点击按钮获得更新时,它将计入新的提要、通知和消息。我也尝试过使用setInterval( "getupdate()", 10000 ),每10秒自动更新一次,但对第二个和第三个div不起作用。

或者因为Ajax不支持很多load()调用?

现在,我不知道该怎么办,需要你的帮助。谢谢

Javascript

</script>
function getupdate(){
    $('#newsfeed').load('getnewsfeed.php');
    $('#notify').load('getnewnoti.php');
    $('#message').load('getnewmessage.php');
}
</script>

HTML

<button type="button" onclick="getupdate()" class="btn btn-primary">Get Update</button>
<div id="newsfeed"></div>
<div id="notify"></div>
<div id="message"></div>

如果并发ajax调用有问题,您可以始终按顺序加载它们:

function getupdate(){
    $('#newsfeed').load('getnewsfeed.php', function(){
        $('#notify').load('getnewnoti.php', function(){
            $('#message').load('getnewmessage.php');
        });
    });
}

如果这没有帮助,我们也需要查看您页面的其余部分,请:)

您还需要检查所有三个服务器方法是否都返回了一些内容而不是错误。