Ajax passes the headers parameter

reqSource parameters are required to be passed to the background through headers in the project

the code is as follows:

        $.ajax({
            type: "post",
            url: url,
            async: true,
            headers: {
                "reqSource": "pc"
            },
            data: data,
            success: function(data) {},
            error: function(data) {
                console.log("");
            }
        });

would like to ask you how to solve

Mar.03,2021

clipboard.png


$.ajax({
    type: "post",
    url: url,
    async: true,
    data: data,
    beforeSend: function(request) {
        request.setRequestHeader("token", token);
        request.setRequestHeader("version", version);
        request.setRequestHeader("taskId", currentTask.id);
    },
    success: function(rs) {
    }
})
Menu