I see one similar question but it does not have an accepted response.
The following ajax request times out. But GET
request on the same URL using browser or curl
work fine. Note this is a cross domain AJAX
since the code sits on a different server and URL is for AWS EC2 (elastbeanstalk) instance.
Any clues why?
$.ajax({
url: "http://<edited>.elasticbeanstalk.com/api/v1/Location",
dataType:'jsonp',
crossDomain:true,
timeout:120000
}).done(function(){
//do something
$("#status").html("SUCESS");
}).fail(function(jqXHR, textStatus){
if(textStatus == 'timeout')
{
//alert('Failed from timeout');
$("#status").html(textStatus);
//do something. Try again perhaps?
}
});
[EDIT] added
When I check the AWS server log I see the GET request is responded with a 200 (success). But still $.ajax request timesout
120.138.116.202 - - [17/Jun/2015:12:12:31 +0000] "GET /api/v1/Location HTTP/1.1" 200 144 "http://yyyy.xxxx.com/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"