title: How to force a program to wait until an HTTP request is finished in JavaScript?
body: <p>Is there a way in JavaScript to send an HTTP request to an HTTP server and wait until the server responds with a reply? I want my program to wait until the server replies and not to execute any other command that is after this request. If the HTTP server is down I want the HTTP request to be repeated after a timeout until the server replies, and then the execution of the program can continue normally.</p>
  
  <p>Any ideas?</p>
  
  <p>Thank you in advance,
  Thanasis</p>