i have ajax called that i need to fire's each 3 seconds, looking for plugins of jquery i found this plugin but i can't make it work. Does anybody could help me. See my code below
$(document).ready(initialize);
function initialize(){
$.ajax({
async: false,
type: "POST",
url: "MapZone.aspx/addingData",
data: "{indicators: '" + 'probando' + "'}",
contentType: "application/json; charset=utf-8",开发者_如何学JAVA
dataType: "json",
success: loadMarkers
}).everyTime(1000, 'controlled');
}
function loadMarkers(data) {
//i do stuff here
}
I don't think you need a plugin for this. You could just use setInterval
to make the AJAX call every 3000 ms:
function initialize() {
setInterval(function () {
$.ajax({
async: false,
type: "POST",
url: "MapZone.aspx/addingData",
data: "{indicators: '" + 'probando' + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: loadMarkers
});
}, 3000);
}
精彩评论