setInterval stops after Ajax request

前端 未结 7 2146
不知归路
不知归路 2021-01-03 15:50

I\'m using Asp.net MVC and I want my partial view to refresh on an interval, which it does until I make an unrelated Ajax request, then it stops.

Here are a few simp

7条回答
  •  日久生厌
    2021-01-03 16:21

    Try adding a bit of randomness to the URL where you're posting the AJAX request. Something like $.post(f.attr("action")+"?"+Math.random(), ...). I have never figured out why this works, but it does (sometimes). Probably because you're preventing the browser from using a cached result for the AJAX response.

提交回复
热议问题