javascript - “预检响应无效(重定向)”错误

标签 javascript jquery ajax post

我正在尝试发布 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'})

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

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

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

最佳答案

只是顺应了 Amazing Aaron 的回答,我遇到了类似的问题,可以确认这是 URL。尝试将 http 的所有大小写更改为 https。这应该可以解决它。

关于javascript - “预检响应无效(重定向)”错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37901562/

相关文章:

javascript - 如何在 JavaScript 中访问 Rails View 变量?

javascript - 标题列中标签的垂直文本

jquery - jQuery 新手,ajax 不工作

带有 HTTP 基本身份验证 header 的 JQuery Remote API

javascript - 鼠标移开时返回原始图像源

javascript - 使用worker启动Node.js项目

javascript - 没有调用 .then 方法时,Promise 是如何运行的?

jQuery 倒计时 Keith Wood 无法在 mozilla 中工作

javascript - 全选复选框不起作用,因为它必须起作用

javascript - 如何将数据发布到 Node 服务器并从中获取响应文本?