📜  如何设置 json 类型 jquery ajax - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:21.840000             🧑  作者: Mango

代码示例2
$.ajax({
            type: "POST",
            url: siteRoot + "api/SpaceGame/AddPlayer",
            async: false,
            data: JSON.stringify({ Name: playersShip.name, Credits: playersShip.credits }),
            contentType: "application/json",
            complete: function (data) {
            console.log(data);
            wait = false;
        }
    });