'Response for preflight is invalid (redirect)' error
10,220
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.
Author by
Amazing Aaron
Updated on June 09, 2022Comments
-
Amazing Aaron almost 2 years
I am trying to post an API.
Here is my code:
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 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