//提交表单
$("#finished_button").on("click", function(){
  var xdomain = $("#detail_form").find("input[name='xdomain']");
  var xapikey = $("#detail_form").find("input[name='xapikey']");
  var socketip = $("#detail_form").find("input[name='socketip']");
  var socketport = $("#detail_form").find("input[name='socketport']");
  if($(xdomain).val()==""){
    layer.msg("请填写客户端接口地址", {icon:2});
    return false;
  }
  if($(xapikey).val()==""){
    layer.msg("请填写客户端接口密钥", {icon:2});
    return false;
  }
  if($(socketip).val()==""){
    layer.msg("请填写Websocket服务器地址", {icon:2});
    return false;
  }
  if($(socketport).val()==""){
    layer.msg("请填写Websocket服务器端口", {icon:2});
    return false;
  }
  $("#detail_form").ajaxSubmit({
      url: '/glconfig/ketang/basicok', 
      type: 'POST',
      dataType: "json", 
      beforeSend: function(){
        layer.load(0, {shade: [0.2, '#393D49']});
      },
      success: function(data){
        if(data.code=="success"){
            layer.msg('成功', {icon: 1});
        }else{
            layer.msg(data.msg, {icon: 2});
        }
      },
      error: function(){
        layer.msg("系统错误，请联系管理员", {icon: 2});
      },
      complete: function(){
        layer.closeAll('loading');
      }
  });
  return false;
});