<script>
$(function(){
$.ajax({
type:"post",
url:"sys/user/add",
dataType:"json",
data:$.param(params)
}).done(function(data){
if(data.sucess==false){
}else{
}
});
});
});
$.fn.serializeObject = function()
{
var o = {};
var a = this.serializeArray();
$.each(a, function() {
if (o[this.name] !== undefined){
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
} else {
o[this.name] = this.value || '';
}
});
return o;
};
$(function(){
var params=$("#myform").serialize();
//或者=$("#myform").serializeObject();
$("#loginBtn").off().click(function(){$.ajax({
type:"post",
url:"sys/user/add",
dataType:"json",
data:$.param(params)
}).done(function(data){
if(data.sucess==false){
}else{
}
});
});
});
$.fn.serializeObject = function()
{
var o = {};
var a = this.serializeArray();
$.each(a, function() {
if (o[this.name] !== undefined){
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
} else {
o[this.name] = this.value || '';
}
});
return o;
};
</script>
<div>
<form id="myform">
<table>
<tr>
<td>姓名</td>
<td><input type="text" name="name" value="1111"></td>
</tr>
<tr>
<td>emial</td>
<td><input type="text" name="email" value="1111@qq.com"></td>
</tr>
<tr>
<td colspan="2"><button id="loginBtn">登录</button></td>
</tr>
</table>
</form>
</div>