mirror of https://gitee.com/karson/fastadmin.git
parent
e50a737777
commit
332e786a83
|
|
@ -10898,12 +10898,31 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator'], function ($, undef
|
||||||
type = type && (type === 'GET' || type === 'POST') ? type : 'GET';
|
type = type && (type === 'GET' || type === 'POST') ? type : 'GET';
|
||||||
url = form.attr("action");
|
url = form.attr("action");
|
||||||
url = url ? url : location.href;
|
url = url ? url : location.href;
|
||||||
|
//修复当存在多选项元素时提交的BUG
|
||||||
|
var params = {};
|
||||||
|
var multipleList = $("[name$='[]']");
|
||||||
|
if (multipleList.size() > 0) {
|
||||||
|
var postFields = form.serializeArray().map(function (obj) {
|
||||||
|
return $(obj).prop("name");
|
||||||
|
});
|
||||||
|
$.each(multipleList, function (i, j) {
|
||||||
|
if (postFields.indexOf($(this).prop("name")) < 0) {
|
||||||
|
params[$(this).prop("name")] = '';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
//调用Ajax请求方法
|
//调用Ajax请求方法
|
||||||
Fast.api.ajax({
|
Fast.api.ajax({
|
||||||
type: type,
|
type: type,
|
||||||
url: url,
|
url: url,
|
||||||
data: form.serialize(),
|
data: form.serialize() + (params ? '&' + $.param(params) : ''),
|
||||||
dataType: 'json'
|
dataType: 'json',
|
||||||
|
complete: function (xhr) {
|
||||||
|
var token = xhr.getResponseHeader('__token__');
|
||||||
|
if (token) {
|
||||||
|
$("input[name='__token__']", form).val(token);
|
||||||
|
}
|
||||||
|
}
|
||||||
}, function (data, ret) {
|
}, function (data, ret) {
|
||||||
$('.form-group', form).removeClass('has-feedback has-success has-error');
|
$('.form-group', form).removeClass('has-feedback has-success has-error');
|
||||||
if (data && typeof data === 'object' && typeof data.token !== 'undefined') {
|
if (data && typeof data === 'object' && typeof data.token !== 'undefined') {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue