<script>
$(function() {
$('#btnLogin').click(function() {
var d = {};
var t = $('form').serializeArray();//t:数组对象、存放了从form中取出的所有数据
// alert(t[0].name + '.....' + t[0].value)
$.each(t, function() {
d[this.name] = this.value; //填充数组d
// alert('.....' + d[this.name])
});
// d['sex'] = '男';
alert(JSON.stringify(d));
});
});
</script>