AJAX Interview Questions and Answers

1. Could you explain what is Ajax?

Ajax is an abbreviation for Asynchronous Javascript and XML. It is a web development techniques used to create better, faster and more interactive web applications. It is a set of client side technologies that allows asynchronous communication between client and web server. It uses asynchronous data transfer between the browser and the web server. We can use HTML and CSS with its combination to style the application and information.

2. Please describe the benefits of AJAX over Java applet.

AJAX takes less loading time than Java applet. AJAX web applications are easily searchable as they are HTML based. AJAX features are an increase from a conventional web application while Java applet web applications are the basic ones. Incompatibility issues arise in Java applets with the change in Java versions while such issues do not arise with AJAX.

3. Would you enumerate the advantages of using AJAX?

It saves memory when the data is obtained from the same page thereby maximum utilization of the bandwidth It is more interactive. It facilitates speedier retrieval of data. Asynchronous behaviour helps to update only a portion of the page without refreshing the whole page.

4. Explain how is encoding handled in AJAX?

Encoding is handled in AJAX in following two ways:
Using encodeActionURL() method to refresh the complete page
Using encodeResourceURL() method to partially update a page

5. Please tell me something about asynchronous behaviour of AJAX.

AJAX's Asynchronous behaviour refers that it has the ability to update only a portion of the page without refreshing the whole page.

6. Would you tell what operations we cannot perform with the help of AJAX?

We are unable to send a request to a server outside of the domain from which the web page originated with the help of AJAX.

7. Please differentiate between Synchronous Postback and Asynchronous Postback.

In Synchronous Postback, complete web page is sent to server and it returns rendering of complete page as an output but in case of Asynchronous Postback, only a portion of the page goes to the server and it renders only the partial portion of the page which is required instead of complete page.

8. Could you explain who is in control - the server or the client in AJAX?

AJAX techniques give facility to be implemented by

  1. server only
  2. client only
  3. mix of both server & client

It is fully dependent on the choice of the technology and architecture by the user but it should always be kept in the mind that while applying server only or client only controls, both should be sync with each other. The most preferable approach is to use a mix of both server side and client side control.

9. Explain in brief about XMLHttpRequest object.

XMLHttpRequest is an API used as an object for transferring data between server and client’s browser. XMLHttpRequest is only part of the Ajax equation. This object allows the data transfer without reloading the page. The data transfer can take place in the format of plain text, HTML, XML or JSON. This object allows to parse the xml format. It is supported by all the browsers.

10. Could you name out which controls come under AJAX?

Following controls come under AJAX-

  1. ScriptManager
  2. ScriptManagerProxy
  3. Timer
  4. UpdatePanel
  5. UpdateProgress