how to use the XMLHttpRequest

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
>getResponseCode();
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());
return;
}
// set header
std::vector *headers = response
>getResponseHeader();

……
}

I remove the ‘return’, then it works!

Awesome!