1
回答
浏览器用jq发送put/delete请求怎么解决
终于搞明白,存储TCO原来是这样算的>>>   

代码如下

        lostDelete:function(lostId){
            var a;
            var keywords={"tokenId":sessionStorage.getItem("tokenIdSave"),
                    "userId":sessionStorage.getItem("userIdSave"),
                    "id":location.hash.substr(1)};
                    console.log(keywords);
             $.ajax({
                type:"DELETE",//http://192.168.0.88:8080
                    url:"http://192.168.0.88:8080/api/app/losts/"+location.hash.substr(1)+"/delete",
                data:keywords,
                contentType:"application/json",
                dataType:"json",
                async:false,
                success: function (res) {
                    console.log(res)
                },
                error: function () {
                   console.log("error")
                }
           });
        }

我的代码就是这样  而且服务器端加了允许跨域的设置了,但是还是这样报错


jquery.js:9631 XMLHttpRequest cannot load http://192.168.0.88:8080/api/app/losts/cf6535f53b674c8e96105f7536a167b2/delete. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8020' is therefore not allowed access.
send @ jquery.js:9631
ajax @ jquery.js:9176
lostDelete @ lostsXiangxi.html:542
(anonymous) @ lostsXiangxi.html:683
dispatch @ jquery.js:4641
jQuery.event.add.elemData.handle @ jquery.js:4309
lostsXiangxi.html:555 error

求解答

<无标签>
举报
梁琪飞
发帖于7个月前 1回/224阅
顶部