TestScript.js

80 lines | 1.665 kB Blame History Raw Download


async function Load() {
    let url = "/ReactCRUD/List";

    var res = await $.get(
        {
            url: url,
            //data: data,
            //success: success,
            dataType: "json"
        }
    );

    var e1 = res[0];
    var s0 = res.filter((elem) => elem['State'] == 0);
    res.push({ ID: 10, Name: "elem10", State: 0 });
    debugger;
    return res;
}

function Load2() {
    let url = "/ReactCRUD/List";

    $.get(
        {
            url: url,
            //data: data,
            success: function (data)
            {
                console.log(data);
                debugger;
            },
            dataType: "json"
        }
    );
}


async function Save() {
    let url = "/ReactCRUD/SaveChange";

    var senddata = [
        { ID: 0, Name: "elem0", State: 0 },
        { ID: 1, Name: "elem1", State: 0 },
        { ID: 2, Name: "elem2", State: 0 },
        { ID: 3, Name: "elem3", State: 0 },
        { ID: 4, Name: "elem4", State: 3 },
    ];

    var res = await $.post({
        url: url,
        data: { json: JSON.stringify(senddata) },
        //success: success,
        dataType: "json"
    });
}

function Save2() {
    let url = "/ReactCRUD/SaveChange";
    console.log(url);

    var senddata = [
        { ID: 0, Name: "elem0", State: 0 },
        { ID: 1, Name: "elem1", State: 0 },
        { ID: 2, Name: "elem2", State: 0 },
        { ID: 3, Name: "elem3", State: 0 },
        { ID: 4, Name: "elem4", State: 3 },
    ];

    $.post({
        url: url,
        data: { json: JSON.stringify(senddata) },
        success: function (data) {
            console.log(data);
            debugger;
        },
        dataType: "json"
    });
}