Skip to content

Commit 32d5cfc

Browse files
committed
pat ajax: Modernize code pt2.
1 parent 3953112 commit 32d5cfc

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/pat/ajax/ajax.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,13 @@ const _ = {
5252
$el.off(".pat-ajax");
5353
},
5454
onClickSubmit(event) {
55-
const $form = $(event.target).parents("form").first();
56-
const name = event.target.name;
57-
const value = $(event.target).val();
55+
const el = event.target;
56+
const form = el.closest("form");
5857
const data = {};
59-
if (name) {
60-
data[name] = value;
58+
if (el.name) {
59+
data[el.name] = el.value;
6160
}
62-
$form.data("pat-ajax.clicked-data", data);
61+
$(form).data("pat-ajax.clicked-data", data);
6362
},
6463
onTriggerEvents(event) {
6564
if (event) {

0 commit comments

Comments
 (0)