Google Interview Question

Browsers running javascript is single threaded, how can we make AJAX calls in the backgroung?

Interview Answers

Anonymous

Nov 28, 2012

JavaScript is single threaded, but AJAX is *asynchronous* (by default), so it runs in a background. If we need another thread, we can use web workers.

Anonymous

Jul 11, 2012

We can use Javascript to make AJAX call in the background. Ex:For Chating ,we need to update the content of chat after every one or three sec so we call the javascript function once and then we use javascript inbuild function Settimeout() which call ajax in the background.