Commit 80cc9cc1 by usualdesigner Committed by Qiang Xue

Basic implementation of the data-params attributes

parent 4267b53d
...@@ -126,7 +126,8 @@ yii = (function ($) { ...@@ -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 ($) { ...@@ -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');
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment