View | Details | Raw Unified | Return to bug 37111
Collapse All | Expand All

(-)a/koha-tmpl/opac-tmpl/bootstrap/js/form-submit.js (-1 / +36 lines)
Line 0 Link Here
0
- 
1
/* keep tidy */
2
$(document).ready(function () {
3
    $(".submit-form-link").click(function (e) {
4
        e.preventDefault();
5
        let form_data = $(this).data();
6
7
        let confirm_msg = form_data.confirmationMsg;
8
        if (confirm_msg) {
9
            let confirmation = confirm(confirm_msg);
10
            if (!confirmation) {
11
                return false;
12
            }
13
            delete form_data.confirmationMsg;
14
        }
15
16
        let the_form = $("<form/>");
17
        if (form_data.method === "post") {
18
            form_data.csrf_token = $('meta[name="csrf-token"]').attr("content");
19
        }
20
        the_form.attr("method", form_data.method);
21
        the_form.attr("action", form_data.action);
22
        delete form_data.method;
23
        delete form_data.action;
24
        $.each(form_data, function (key, value) {
25
            the_form.append(
26
                $("<input/>", {
27
                    type: "hidden",
28
                    name: key,
29
                    value: value,
30
                })
31
            );
32
        });
33
        $("body").append(the_form);
34
        the_form.submit();
35
    });
36
});

Return to bug 37111