Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | RebiDesi |
extends HTTPRequest
var Address = "https://examplewebsite.com/example.json"
var JsonGet
func _ready():
connect("request_completed", self, "_requested")
_request_json()
func _request_json():
request(Address)
func _requested(Result, ResponseCode, Headers, Body):
var Json = JSON.parse(Body.get_string_from_utf8())
JsonGet = Json.result
get_parent().get_node("Test").text = str(JsonGet)
This is my code, and it works just fine both in the built-in tester and in desktop exports, but when exporting to HTML5 it just turns up null.
It gives me a result 4 for some reason (Request failed due to connection (read/write) error.)
Any help?
Is Access-Control-Allow-Origin: *
set on the remote site? otherwise it will be blocked by the CORS policy (you will see the error on the console).
eons | 2022-04-12 00:50