Ajax Interview Questions

Here is a list of commonly asked AJAX questions with answers for interviews.

What is AJAX?

In one sense, AJAX is simply an acronym for “Asynchronous JavaScript And XML” In another, it is a protocol for sending requests from a client (web page) to a server, and how the information is / should be communicated between the client and the server

Is AJAX a programming language?

No

How new is AJAX?

The terminology is new, but the techniques are not.

When can/should AJAX be used?

AJAX is best suited for small (hopefully unobtrusive) updates to the current web page, based on information that is not available until it has been provided by the end user.

Describe the formats and protocols used/specified by AJAX

The client web page is responsible for creating the XmlHttpRequest, and therefore the connection from the web page to some application on the server.

Part of this connection identifies how the response can / should be provided to the client code – via the use of a “callback” routine.

The callback routine is invoked multiple times with a status code, indicating the reason for the invocation.

If the request can be successfully completed by the server application, a response should also be provided.

Describe the formats and protocols used/specified by AJAX

The client web page is responsible for creating the XmlHttpRequest, and therefore the connection from the web page to some application on the server. Part of this connection identifies how the response can / should be provided to the client code – via the use of a “callback” routine. The callback routine is invoked multiple times with a status code, indicating the reason for the invocation. If the request can be successfully completed by the server application, a response should also be provided.

Describe some things that can’t be done with AJAX

Sending a request to a server outside of the domain from which the web page originated.

How should AJAX objects be created?

In a browser general manner, if at all possible.

For what error conditions should programs check?

The connection cannot be established. The request does not complete in a timely fashion or Unexpected response