Set - 4

Question 1 :

How do I create a thread to do AJAX polling?

Answer :

JavaScript does not have threads. JavaScript functions are called when an event happens in a page such as the page is loaded, a mouse click, or a form element gains focus. You can create a timer using the setTimeout which takes a function name and time in milliseconds as arguments. You can then loop by calling the same function as can be seen in the JavaScript example below.

function checkForMessage() {
	// start AJAX interaction with processCallback as the callback function

// callback for the request
function processCallback() {
	// do post processing
	setTimeout("checkForMessage()", 10000);

Notice that the checkForMessage will continue to loop indefinitely. You may want to vary the increment the interval based on activity in the page or your use cases. You may also choose to have logic that would break out of the loop based on some AJAX response processing condition.

Question 2 :

Whats with the -alpha in the install instructions?

Answer :

HTML_AJAX hasn't had a stable release yet and the pear installer doesn't install non stable packages by default unless you specify a version.

Question 3 :

How do I test my AJAX code?

Answer :

There is a port of JUnit for client-side JavaScript called JsUnit

Question 4 :

What exactly is the W3C DOM?

Answer :

The W3C Document Object Model (DOM) is defined by the W3C as the following: The Document Object Model is a platform- and language-neutral interface...

Question 5 :

When will HTML_AJAX have a stable release?

Answer :

Once all the major features are complete and the API has been tested, the roadmap gives an idea of whats left to be done.