I am a new programmer whose primary background is in Java. I am attempting to write in fault handling to a program in Javascript as I would in Java. In java I use the Apache HTTP client to both create the client and call the Httpget request.
HttpClient cli = new DefaultHttpClient();
cli.getParams().setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 5000);
HttpResponse resp = null;
for (int i = 0 ; i < 5 ; i++) {
try {
resp = cli.execute(new HttpGet("http://example.org/products"));
}
catch{//code}
}
I am unsure how to emulate this behavior in a javascript environment. Does anyone have insight or knowledge into this field?