tags:

views:

80

answers:

2

We have AJAX calls to hit a URL. Do we have option to run/execute JavaScript function in Asynchronous mode?

Note: setTimeout() will execute that function after some seconds but still that will execute in Synchronous mode.

+2  A: 

No. JavaScript runs in a single thread per page.

However, the Google Gears plugin provides a WorkerPool:

WorkerPool API

The WorkerPool API allows web applications to run JavaScript code in the background, without blocking the main page's script execution.

There's also a proposal by the Gears team to add this to HTML5.

a paid nerd
+3  A: 

Most modern browsers implement JavaScript Web Workers, they provide a simple way to run scripts in background threads.

Check the following articles:

CMS