//提交表单
$("#finished_button").on("click", function(){
    var courseid = $("#detail_form").find("input[name='courseid']").val();
    var title = $("#detail_form").find("input[name='title']").val();
    var sectionid = $("#detail_form").find("input[name='sectionid']").val();
    if(title==""){
      $.toast('请填写名称');
      return false;
    }
    $.ajax({
        url: '/glcourse/section/basicok', 
        type: 'POST',
        dataType: "json", 
        data: $("#detail_form").serialize(),
        beforeSend: function(){
          $.showIndicator();
        },
        success: function(data){
          if(data.code=="success"){
            $.toast('保存成功');
            setTimeout(function(){parent.location.reload();}, 2000);
          }else{
            $.toast(data.msg);
          }
        },
        error: function(){
          $.toast("系统错误，请联系管理员");
        },
        complete: function(){
          $.hideIndicator();
        }
    });
    return false;
});

//取消按钮
$("#canceled_button").on("click", function(){
  var sectionid = $("#detail_form").find("input[name='sectionid']").val();
  parent.closeSectionEditBox(sectionid);
});