How can I call an Ajax Request in a specific time Period? Should I use Timer Plugin or does jQuery have a plugin for this?
相关问题
- Carriage Return (ASCII chr 13) is missing from tex
- How to fix IE ClearType + jQuery opacity problem i
- jQuery add and remove delay
- Using :remote => true with hover event
- Is there a way to play audio on a mobile browser w
A bit late but I used jQuery ajax method. But I did not want to send a request every second if I haven't got the response back from the last request, so I did this.
You have a couple options, you could
setTimeout()
orsetInterval()
. Here's a great article that elaborates on how to use them.The magic is that they're built in to JavaScript, you can use them with any library.
use jquery Every time Plugin .using this you can do ajax call for "X" time period
you can also use setInterval
You can use the built-in javascript setInterval.
or if you are the more terse type ...
you can use
setInterval()
in javascriptI found a very good jquery plugin that can ease your life with this type of operation. You can checkout https://github.com/ocombe/jQuery-keepAlive.