Home / Interview / AJAX :: General Questions

Interview :: AJAX

11) What are the types of open() method used for XMLHttpRequest?
  • open(method, URL) - It opens the request specifying get or post method and URL.
  • open(method, URL, async) - It is same as above but specifies asynchronous or not.
  • open(method, URL, async, username, password) - It is same as above but specifies the username and password.
12) What are the types of send() method used for XMLHttpRequest?
  • send() - It sends get request
  • send(string) - It sends post request.
13) What is the role of the callback function in AJAX?

The callback function passes a function as a parameter to another function. If we have to perform various AJAX tasks on a website, then we can create one function for executing XMLHttpRequest and a callback function to execute each AJAX task.

how ajax works, flow of ajax
14) What is JSON in AJAX?

JSON stands for JavaScript Object Notation. In AJAX, it is used to exchange data between a browser and a server. It is easy to understand, and data exchange is faster than XML. It supports array, object, string, number, and values.

15) What are the tools for debugging AJAX applications?

There are several tools for debugging AJAX applications.

  • Firebug for Mozilla Firefox
  • Fiddler for IE (Internet Explorer)
  • JavaScript HTML Debugger
  • MyEclipse AJAX Tools
  • Script Debugger
16) What are the types of post back in AJAX?

There are two types of post back in AJAX.

  • Synchronous Postback - It blocks the client until the operation completes.
  • how synchronous request works
  • Asynchronous Postback - It doesn?t block the client.
  • how asynchronous request works
17) What are the different ready states of a request in AJAX?

There are 5 ready states of a request in AJAX.

  • 0 means UNOPENED
  • 1 means OPENED
  • 2 means HEADERS_RECEIVED
  • 3 means LOADING
  • 4 means DONE
18) What are the common AJAX frameworks?
  • Dojo Toolkit
  • YUI
  • Google Web Toolkit (GWT)
  • Spry
  • MooTools
  • Prototype
19) How can you test the AJAX code?

JUnit is the open source unit testing framework for client-side JavaScript. It is required to create test cases. The unit test case is a code which ensures that the program logic works as expected.

20) What is the difference between JavaScript and AJAX?
JavaScript is an object-based scripting language. AJAX is a group of inter-related technologies like JavaScript, XML, HTML, CSS etc
It requests the server and waits for the response. It sends a request to the server and doesn't wait for the response.
It consumes more bandwidth as it reloads the page. It doesn't reload the page so consumes less bandwidth.