<form id='addForm' action='UserAdd.action' type='post'>
<label for='uname'>用户名</label>:<input type='text' name='uname' id='uname'><br>
<label for='mobileIpt'>手机号:</label><input type='text' name='mobileIpt' id='mobileIpt'><br>
<label for='birthday'>生日:</label><input type='text' name='birthday'><br>
<input type='button' value='提交' οnclick='addUser()'>
</form>
function addUser(){
var user = {
uname:$("#uname").val(),
mobileIpt:$("#mobileIpt").val(),
birthday:$("#birthday").val()
};
$.ajax({
url:'UserAdd.action',
data:user,
type:'post',
dataType:'text',
success:function(msg){
if(msg=='1'){
console.log('添加成功');
}else{
console.log('添加失败')
}
}
})
}