$(document).ready(function(){
  //筛选
  var form = layui.form;
  form.on('select(changecourse)', function(data){
    $("#detail_form").submit();
  });
});

$("#detail_submit").on("click", function(){
    var resourceids = parent.$("#moveto_form").find("input[name='resourceids']").val();
    $("#detail_form").find("input[name='resourceids']").val(resourceids);
    var se_treeid = $("#detail_form").find("select[name='se_treeid']");
    if($(se_treeid).val()==""){
      layer.msg('请选择章节知识点', {icon: 2});
      return false;
    }
    $("#detail_form").ajaxSubmit({
        url: '/glquesti/moveto/movetook', 
        type: 'POST',
        dataType: "json", 
        beforeSend: function(){
          layer.load(0, {shade: [0.2, '#393D49']});
        },
        success: function(data){
          if(data.code=="success"){
              layer.msg('成功', {icon: 1}, function(){parent.location.reload();});
          }else{
              layer.msg(data.msg, {icon: 2});
          }
        },
        error: function(){
          layer.msg("系统错误，请联系管理员", {icon: 2});
        },
        complete: function(){
          layer.closeAll('loading');
        }
    });
    return false;
});