jquery插件之定时查询待处理任务数量


(function ($) {
    var element;
    $.fn.pull_todo_count = function () {
        var a = $('<a>0个审核待申请</a>');
        a.attr("href","/process/todo_list");
        a.appendTo($(this));
        $(this).hide();
        element = $(this);
        timerRequestData();
    };
    function timerRequestData() {
        $.ajax({
            url:'/pull_todo_count',
            type:'get',
            data:null,
            dataType:'json',
            success:function(data){
                var count = data["todo_count"];
                console.log(count);
                if(count > 0){
                    element.children("a").html(count+"个审核待申请");
                    element.show();
                }else{
                    element.hide();
                }
            }
        });
        setTimeout(timerRequestData,60000);
    }
})(jQuery);

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wgppjz.html