local xhr = cc.XMLHttpRequest:new() xhr.responseType = cc.XMLHTTPREQUEST_RESPONSE_STRING --返回的数据类型,可以是json等 xhr:open("GET","http://www.baidu.com") local function onReadyStateChange() if xhr.readyState == 4 and xhr.status == 200 then print( xhr.response ) end xhr:unregisterScriptHandler() end xhr:registerScriptHandler(onReadyStateChange) xhr:send() --POST时,可以通过这个发送参数 GET使用链接附带参数