我正在尝试发布 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/