mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-02 13:02:24 +08:00
Basic implementation of the data-params attributes
This commit is contained in:
@ -126,7 +126,8 @@ yii = (function ($) {
|
||||
handleAction: function ($e) {
|
||||
var method = $e.data('method'),
|
||||
$form = $e.closest('form'),
|
||||
action = $e.attr('href');
|
||||
action = $e.attr('href'),
|
||||
params = $e.data('params');
|
||||
|
||||
if (method === undefined) {
|
||||
if (action && action != '#') {
|
||||
@ -157,6 +158,11 @@ yii = (function ($) {
|
||||
if (csrfParam) {
|
||||
$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');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user