how to use the XMLHttpRequest

how to use the XMLHttpRequest
0.0 0


when I use XMLHttpRequest , if the request is ok, the onreadystatechange fun will be called, but it doesn’t work when the request isn’t ok(eg.the url is wrong or network is close), the onreadystatechange fun will not be called. So, could you tell me how can I handle the not ok result?
sorry, my english is not good:(


oyeah, I knew how to resolve this problem,

void MinXmlHttpRequest::handle_requestResponse(cocos2d::extension::CCHttpClient sender, cocos2d::extension::CCHttpResponseresponse)

if (0 != strlen(response~~>getHttpRequest~~>getTag))
CCLOG ("%s completed", response->getHttpRequest()>getTag);
int statusCode = response
char statusString[64] = {};
sprintf(statusString, “HTTP Status Code: d, tag = s”, statusCode, response->getHttpRequest()>getTag);
if )
CCLOG (“response failed”);
CCLOG (“error buffer: %s”, response->getErrorBuffer());
// set header
std::vector *headers = response


I remove the ‘return’, then it works!