开机自检无法正常工作,出现错误

JQuery POST not working with error

本文关键字:错误 工作 常工作 开机自检      更新时间:2023-09-26

当我尝试使用JQuery发布时,出现此错误:
jquery.min.js:4 POST http://localhost:8000/post,json 501 (Unsupported method ('POST'))

这是我的代码:

<html>
    <head>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"</script>
    </head>
    <body>
        <script>
            $.ajax({
                type: "post",
                dataType: "json",
                url: "./post,json",
                success: function(data) {
                    alert(data.msg);
                }, data: {
                    name: "chris",
                    grade: 11
                }
            });
        </script>
    </body>
</html>

我做错了什么?

也许是您的网址有问题? "./post,json"看起来很奇怪。此外,您不能在url中使用coma,否则必须引用它。


您也可以尝试更改数据

data: JSON.stringify({
    name: "chris",
    grade: 11
})