Do you know that? biggest challenge for 20.9% freelancers is project management next

How do I create a thread to do AJAX polling?

  •  JavaScript does not provide threads. JavaScript functions are called after an event occurred on a page like the page is loaded, a mouse click, or a form element get focused. 
  •  You can make a timer by using the setTimeout which requires a function name and time in milliseconds as its arguments. 
  •  Calling the same function using loop which is given in the JavaScript example below.
  function checkForMsg() {
  // start AJAX interaction with handleCallback as the callback function
  }
  // callback for the request
  function handleCallback() {
  // do post processing
  setTimeout("checkForMsg()", 20000);
  }
  Note that the checkForMessage will continue to loop infinitely. You may want to change the increment interval based on activity. You may also want to change the logic which will break the loop based on some AJAX response executing condition.