????????? ?<form>
????????????? ? <input name="username" type="text"/>
????????????? ? <input name="password" type="password"/>
????????????? ? <input id="submitButton" type="button" value="submit">
????????????</form>
?????????????$("#submitButton").click(function(){
????????????????????var data = {};
? ? ????????var t = $('form').serializeArray();
? ? ????????$.each(t, function() {
? ? ??????? ?????data?[this.name] = this.value;
? ? ????????});
? ? ????????alert(JSON.stringify(data));
????????????});
原文:https://www.cnblogs.com/jichi/p/11965106.html