开发者

jquery plugin timers ajax called

开发者 https://www.devze.com 2023-03-16 20:17 出处:网络
i have ajax called that i need to fire\'s each 3 seconds, looking for plugins of jquery i found this pluginbut i can\'t make it work. Does anybody could help me. See my code below

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

精彩评论

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

关注公众号