{"project":{"name":"test name","description":"test description","identifier":"testid",{"custom_fields":[{"value":"2015-12-01","id":4},{"statr":"2015-12-31,"id":5}]},stack":"Java","enabled_module_names":["issue_tracking","time_tracking"],"tracker_ids":["1","2","3"]}}
{"custom_fields":[{"value":"2015-12-01",{"value":"2015-12-31,"id":5}]}
单词值不会改变,也应该将输入值作为日期格式,id也是常量.
$(document).ready(function(){
$.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 {"project":o};
};
$(function() {
$('form').submit(function() {
$('#result').text(JSON.stringify($('form').serializeObject()));
return false;
});
});
PHP">PHPBox-inline" name="modules">
Box" id="inlineCheckBox1" name="enabled_module_names" value="issue_tracking"> Issue Tracking
Box-inline">
Box" id="inlineCheckBox2" name="enabled_module_names" value="time_tracking"> Time Tracking
Box-inline">
Box" id="inlineCheckBox3" name="enabled_module_names" value="gantt"> Gant
Box-inline" >
Box" id="inlineCheckBox1" name="tracker_ids" value="1"> Bug
Box-inline">
Box" id="inlineCheckBox2" name="tracker_ids" value="2"> Feature
Box-inline">
Box" id="inlineCheckBox3" name="tracker_ids" value="3"> Support
最佳答案
原文链接:https://www.f2er.com/jquery/427746.html