Passed
Push — master ( 6d380d...e9af9a )
by Robson
02:20
created

example/js/script.js   A

Complexity

Total Complexity 5
Complexity/F 1.25

Size

Lines of Code 38
Function Count 4

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 16
mnd 1
bc 1
fnc 4
dl 0
loc 38
rs 10
bpm 0.25
cpm 1.25
noi 0
c 0
b 0
f 0
1
$(function () {
2
    /*
3
    * APP MODAL
4
    * Monitoramento do smodalname
5
    */
6
    $(document).on('click', "[smodalname]", function (e) {
7
        e.preventDefault();
8
        $(this).smodal();
9
    });
10
11
12
    /*
13
    * APP MODAL
14
    * Monitoramento do data-post fazendo ajax
15
    */
16
    $(document).on("click", "[data-post]", function (e) {
17
        e.preventDefault();
18
19
        var clicked = $(this);
20
        var data = clicked.data();
21
22
        $.ajax({
23
            url: data.post,
24
            type: "POST",
25
            data: data,
26
            dataType: "json",
27
            success: function (response) {
28
29
                if (response.smodal) {
30
                    $(document).smodal(response.smodal);
31
                }
32
33
            }
34
        });
35
    });
36
37
38
});