jQuery:setInterval无效

时间:2015-02-27 17:30:05

标签: jquery ajax

我试图通过jQuery运行setInterval。问题是它完全打破了我的jQuery脚本。我怀疑某处有错误,但我似乎无法找到它,是吗?

jQuery(document).ready(function(){
 setInterval(function() {

  jQuery.ajax({
    url: "admin-ajax.php",
    data : {action: "check_noti_log"},
    context: this,
    success:function(data){

         if(data.length == 0)
             // no new notification
         else
         {
             // the count is returned, insert it in the first a tag inside #wp-admin-bar-noti-bar list item
             jQuery('#wp-admin-bar-noti-bar').children().first().html(data);

             // change element id to new
             jQuery('#wp-admin-bar-noti-bar').attr('id','wp-admin-bar-noti-bar-new');
         }

    }
  });

 }, 60000);

});

1 个答案:

答案 0 :(得分:1)

看看你错过了什么:

if(data.length == 0){ //此括号

} // and the close one
相关问题