function addItems() {
  $("#gotopage").find("input[name='curpage']").val(nextPage);
  $.ajax({
    url: '/yidong/doketang/index', 
    type: 'POST',
    dataType: "html", 
    data: $("#gotopage").serialize(),
    beforeSend: function(){
      $(".infinite-scroll-preloader").show();
      $(".load-more-button").hide();
    },
    success: function(data){
      $('.infinite-scroll-bottom .list-container').append(data);
      nextPage ++;
    },
    error: function(){
      $.toast("系统错误，请联系管理员");
    },
    complete: function(){
      $(".infinite-scroll-preloader").hide();
      $(".load-more-button").show();
      if(nextPage > maxPages){
        $(".load-more-button").remove();
        $(".infinite-scroll-preloader").remove();
      }
    }
  });
}

$(".load-more-button").click(function(){
  if(nextPage <= maxPages){
    addItems();
  }
});

//加载第1页
addItems();

//筛选
function searchRunning(){
  $("#search_form").submit();
}

//重置
function searchRecover(){
  $("#search_form").find("input[name='se_title']").val("");
  $("#search_form").find("select[name='se_courseid']").val("");
  $("#search_form").find("input[name='curpage']").val(1);
  $("#search_form").submit();
}