0a74a317 by yangjianbin

init

1 parent 988dadd1
......@@ -3,22 +3,23 @@
<body>
<div class="panel panel-default">
<div class="panel-body">
<form action="system/user/add" id="add">
<div class="row cl">
<div class="form-group col-sm-4 col-md-2">
<label>用户名</label>
<input type="text" class="form-control input-text" value="">
<input type="text" class="form-control input-text" name="username" value="">
</div>
<div class="form-group col-sm-4 col-md-2">
<label>真实姓名</label>
<input type="text" class="form-control input-text" value="">
<input type="text" class="form-control input-text" name="name" value="">
</div>
<div class="form-group col-sm-4 col-md-2">
<label>手机号</label>
<input type="text" class="form-control input-text" value="">
<input type="text" class="form-control input-text" name="phone" value="">
</div>
<div class="form-group col-sm-4 col-md-2">
<label>身份证号码</label>
<input type="text" class="form-control input-text" value="">
<input type="text" class="form-control input-text" name="" value="">
</div>
</div>
<div class="row cl">
......@@ -55,6 +56,7 @@
</select>
</div>
</div>
</form>
</div>
</div>
......@@ -76,8 +78,35 @@
}
function save() {
var targetUrl = $("#add").attr("action");
var data = $("#add").serializeJson();
$.ajax({
type: 'post',
url: apiBaseUrl + targetUrl,
cache: false,
data: JSON.stringify(data),
dataType: 'json',
contentType: "application/json; charset=UTF-8",
success: function (data) {
if (data.msg) {
layer.alert(data.msg);
} else if (data.code != 0) {
layer.alert('操作失败');
} else {
layer.alert('操作成功');
}
if(!data.code) {
window.parent.msg('添加成功');
window.parent.reload();
layer_close();
}
},
error: function () {
layer.alert("操作失败")
}
})
window.parent.msg('添加成功')
layer_close();
}
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!