开发者

jquery plugin timers ajax called

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);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜