I want to get my game online config sync,i used XMLHttpRequest like this
local xhr = cc.XMLHttpRequest:new()
xhr.responseType = cc.XMLHTTPREQUEST_RESPONSE_JSON
xhr.timeout = TableConfig.HTTP_TIME_OUT
xhr:setRequestHeader("Content-Type", "application/json")
**xhr:open("POST", TableConfig.HTTP_URL_JSON, false)**
xhr:send(self._tSendJson)
if xhr.readyState == 4 and(xhr.status >= 200 and xhr.status < 207) then
local response = xhr.response
local output = json.decode(response)
return output
end
return nil
I have test the function it is not synchronized,XMLHttpRequest does not support synchronized?