Javascript : Using Synchronous XHR Request