'预检的响应无效(重定向)'错误 [英] 'Response for preflight is invalid (redirect)' error

查看:110
本文介绍了'预检的响应无效(重定向)'错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试发布API。

I am trying to post an API.

这是我的代码:

function update(object){
    var data = '<roblox xmlns:xmime="http://www.w3.org/2005/05/xmlmime"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:noNamespaceSchemaLocation="http://www.roblox.com/roblox.xsd"
       version="4">
       <External>null</External><External>nil</External>
       <Item class="StringValue" referent="RBX0">
            <Properties>
                <string name="Name">Notifications</string>
                <string name="Value">'+JSON.stringify(object)+'</string>
            </Properties>
       </Item>
    </roblox>'

    $.post("https://data.roblox.com/Data/Upload.ashx?type=Model&assetid=436257202&length="+data.length,data)

}

update({name:'test'})

但它在控制台中显示错误:

But it shows error in console:


XMLHttpRequest无法加载
< a href =https://data.roblox.com/data/upload.ashx?type=Model&assetid=436257202&length=406\"rel =nofollow noreferrer> https://data.roblox.com/data /upload.ashx?type=Model&assetid=436257202&length=406 。
预检的响应无效(重定向)

XMLHttpRequest cannot load https://data.roblox.com/data/upload.ashx?type=Model&assetid=436257202&length=406. Response for preflight is invalid (redirect)

我认为数据是正确的,但我不确定为什么会出现此错误已经出现

I think the data is correct, but I am not sure why this error has arisen

推荐答案

只是躲开了Amazing Aaron的回答,我遇到了类似的问题并且可以确认它是URL。尝试将 http 的所有情况更改为 https 。这应解决它。

Just piggybacking off of Amazing Aaron's answer, I had a similar issue and can confirm that it was the URL. Try changing all of the cases of http to https. This should resolve it.

这篇关于'预检的响应无效(重定向)'错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆