//ajax提交表单元素name为数组(如row[XXX])的表单的所有参数
js
var params = {};
var t = $('form').serializeArray();
$.each(t, function () {
var key = this.name.replace('row[', '').replace(']', '')
params[key] = this.value;
});
$.ajax('handle.php', {
type: 'post',
data: {
params: JSON.stringify(params),
},
success: function () {
},
error: function () {
}
});
handle.php
接收方法:
$params = json_decode(html_entity_decode($this->request->post('params')), true);