//提交表单
$("#finished_button").on("click", function(){
  var oldpassw = $("#detail_form").find("input[name='oldpassw']");
  var newpassw = $("#detail_form").find("input[name='newpassw']");
  if($(oldpassw).val()==""){
    layer.tips('请填写旧密码', $(oldpassw), {tips: [1, '#FF5722']});
    return false;
  }
  if($(newpassw).val()==""){
    layer.tips('请填写新密码', $(newpassw), {tips: [1, '#FF5722']});
    return false;
  }
  $("#detail_form").ajaxSubmit({
    url: '/user/chanpass/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;
});