mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-03 05:48:11 +08:00
Basic implementation of the data-params attributes
This commit is contained in:
@ -126,7 +126,8 @@ yii = (function ($) {
|
|||||||
handleAction: function ($e) {
|
handleAction: function ($e) {
|
||||||
var method = $e.data('method'),
|
var method = $e.data('method'),
|
||||||
$form = $e.closest('form'),
|
$form = $e.closest('form'),
|
||||||
action = $e.attr('href');
|
action = $e.attr('href'),
|
||||||
|
params = $e.data('params');
|
||||||
|
|
||||||
if (method === undefined) {
|
if (method === undefined) {
|
||||||
if (action && action != '#') {
|
if (action && action != '#') {
|
||||||
@ -157,6 +158,11 @@ yii = (function ($) {
|
|||||||
if (csrfParam) {
|
if (csrfParam) {
|
||||||
$form.append('<input name="' + csrfParam + '" value="' + pub.getCsrfToken() + '" type="hidden">');
|
$form.append('<input name="' + csrfParam + '" value="' + pub.getCsrfToken() + '" type="hidden">');
|
||||||
}
|
}
|
||||||
|
if (params && $.isPlainObject(params)) {
|
||||||
|
$.each(params, function (idx, obj) {
|
||||||
|
$form.append('<input name="' + idx + '" value="' + obj + '" type="hidden">');
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$form.hide().appendTo('body');
|
$form.hide().appendTo('body');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user