「jquery入門」 serialize()とserializeArray()の使い方

サンプルコード:
$(function() {
$(#cftBtn).click(function() {
var params1 = $(#myform).serialize();
var params2 = $(#myform).serializeArray();
console.log(params1);
//name=yamada&sex=false&age=26
console.log(params2);
//[{“name":"yamada","sex":"female","age":"25″},
{“name":"suzuki","sex":"male","age":"32″}]
$.ajax( {
type : POST,
url : ${contextPath}/User/doReg,
data : params1,
success : function(msg) {
alert(“success:"+ msg);
}
});
})
})

jQuery

Posted by arkgame