Ajax Technical Interview Questions

What is Ajax?

Ajax is a set of web development techniques. It stands for Asynchronous JavaScript and XML, and is primarily used for creating better, faster, and more interactive web applications.

It incorporates the concepts of XML, HTML, CSS, and Java Script to make these web applications. It uses XHTML for content, CSS for presentation, along with Document Object Model and JavaScript for dynamic content display.

Ajax is primarily utilized on the client-side, and can be used to send data to and retrieve data from a server asynchronously, i.e. in the background. This allows the application to run without interfering with the display and behavior of the existing page.

What are Ajax applications?

Ajax is a set of web development techniques that use many web technologies on the client-side to create asynchronous Web applications. Basically, Ajax applications are browser based applications that are platform independent are used by Ajax. Ajax primarily utilizes JavaScript and XML in order to develop technologies.

What are the advantages of AJAX?

Ajax is a widely used web development technique. Hence, like everything else it has a set of advantages and disadvantages. The following are a set of advantages of AJAX:

  • Has a quick response rate
  • Fast retrieval of data, so increases performance and speed
  • Reduces the traffic travels between the client and the server.
  • Effectively utilizes bandwidth
  • Saves memory when the data is fetched from the same page
  • User is not blocked until data is retrieved from the server
  • Can be used with JSON as an alternative to XML
  • Can use Firefox browser with an add-on called as Firebug to debug all Ajax calls
  • Ready Open source JavaScript libraries are available for use, such as JQuery, Prototype, Scriptaculous, etc.
  • Communicates over HTTP Protocol
What are the disadvantages of AJAX?

Ajax is a widely used web development technique. Hence, like everything else it has a set of advantages and disadvantages. The following are a set of disadvantages of AJAX:

  • It is dependent on JavaScript
  • Is more complex than building classic web application
  • Can increase design and development time
  • It has certain security issues
  • Source code is easily human readable
  • All files are downloaded at client side, is a security issue
  • It is difficult to debug
  • It increases the size of the requests
  • Has a slow and unreliable network connection
  • Has a problem with browser back button when using AJAX enabled pages
  • Search Engine like Google cannot index AJAX pages.
  • JavaScript disabled browsers cannot use the application.
  • Can only use it to access information from the host that served the initial page
  • Not possible to display information from another server
What are the technologies used by AJAX?

Ajax is commonly used to represent a broad group of Web technologies. These web technologies can be used to implement a web application that can communicate with a server in the background, all the while not interfering with the current state of the page. In order to do this, Ajax utilizes the following technologies:

  • HTML (or XHTML) and CSS for presentation
  • The Document Object Model (DOM) for dynamic display of and interaction with data
  • JSON or XML for the interchange of data, and XSLT for its manipulation
  • The XMLHttpRequest object for asynchronous communication
  • JavaScript to bring these technologies together
What are some of the real web applications of AJAX?

Ajax is a popular and commonly used web technology. Some of the real web applications that utilize Ajax are as follows:

  • Twitter
  • Facebook
  • Gmail
  • Java Point
  • Youtube
  • Digg
  • Reddit
  • So many more…
What are all the controls of Ajax?

The AJAX server controls add script to the page which is executed and processed by the browser. In addition, they also have methods and event handlers that are processed on the server side. This is similar to other ASP.NET server controls.

The following are all the controls of Ajax:

  • The ScriptManager Control – is the most important control. Has basic syntax. It must be present on the page for other controls to work. It manages client script for AJAX-enabled ASP.NET web pages.
  • The ScriptManagerProxy control – Enables nested components such as content pages and user controls to add script and service references to pages when a ScriptManager control is already defined in a parent element.
  • The UpdatePanel Control – is a container control and derives from the Control class. It initiates the post asynchronously and updates just that portion of the page. It also provides feedback to the browser. Allows for a partial-page update, and the building of rich, client-centric web applications.
  • The UpdateProgress control – manages the upgradation of the panel controls. It provides status information about partial-page updates in UpdatePanel controls.
  • The Timer Control – used to initiate the post back automatically at defined intervals. This could be done by Setting the Triggers property of the UpdatePanel control or by placing a timer control directly inside the UpdatePanel to act as a child control trigger. It can enable partial-page updates at a defined interval, as well as post the whole page.
What are the security issues with AJAX?

As with any software and application, AJAX also has certain security issues present which could lead to concern down the line. The primary concern is the fact that AJAX calls are sent in plain text format. Hence, it could lead to an insecure database access.

Another concern is the fact that with AJAX the data gets stored on the clients browser, which can possible be access by anyone. Ajax also allows monitoring browsing sessions by inserting scripts, which can also be a concern.

Ajax may also encourage developers to use multiple server side pages thereby introducing multiple entry points for attackers.

How many types of triggers are present in update panel?

There are two types of triggers present in an update panel. These are the PostBackTrigger and the AsyncPostBackTrigger.

The PostBackTrigger works as full postback. It is somewhat similar to File Upload Control and is primarily useful to control the postback. However, it does not work asynchronously.

The AsyncPostBackTrigger does a partial post back, and it does it asynchronously.

What is the name of the DLL that contains Ajax control tool kit?

The Ajax control tool kit is contained in the AjaxControlToolkit.dll. The dll is available over the internet for most users. The users can add Ajax to their website via two primary ways, such as either adding the dll to the tool box or copying it directly in the bin folder.

How to control the duration of an Ajax request?

The default duration of an Ajax request is 90 seconds. However, it is possible to change the duration of the request. In order to control the duration of an Ajax request, one can use AsyncPostBackTimeout. AsyncPostBackTimeout is a property of the ScriptManagercontrol, one that allows one to change the duration of an Ajax request.


<asp:ScriptManager runat=”server” id=”sample” AsyncPostBackTimeout=”40”/>
What does XMLHttpRequest do?

The XMLHttpRequest Object is an API that can be used by JavaScript, JScript, VBScript, and other web browser scripting languages. It allows the transfer of data between a web browser and a web server. It is supported by most modern browsers.

The XMLHttpRequest allows one to update parts of a web page, without reloading the whole page, which can be very useful at times. It also allows one to request data from a server even after the page has loaded, as well as receive data from a server after the page has loaded. One can also send data to a server in the background.

What are the properties of XMLHttpRequest?

XMLHttpRequest is used to transfer data between a web browser and server. Here are its properties:

  • Onreadystatechange: This property calls a function on every state change.
  • ready state: This property holds the status of XMLHttpRequest.

0: The request is not initialized 
1: The server connection has been established
2: The request has been received 
3: The request is in process
4: The request is completed

  • responseText: It returns the response as a string.
  • response XML: It returns the response as a XML document. This should be used if one needs to return multiple values from the AJAX request.
  • Status: Returns the status-number of the request from server such as 200 for “OK” or 404 for “Not Found”.
  • status Text: Returns the status as text instead of number such as “OK” or “Not Found”.
What are the important methods of XMLHttpRequest?

The important methods of XMLHttpRequest are:

  • Abort()

Cancel the current request.

  • GetAllResponseHeaders()

It returns the headers as a string.

  • GetResponseHeader()

It returns the specified header information.

  • Open(method,url,async,uname,pswd)

It specifies the request, URL and other optional attributes of a request.
The method parameter can have a value of "GET" or "POST".
The URL specifies the location of the file on the server.
The async specifies whether the request should be handled asynchronously or not. True means asynchronous and false means synchronous while handling the request.

  • Send(string)

It sends the request to the server.

  • SetRequestHeader()

Adds a label/value pair to the header which is to be sent

JavaScript Object Notation (JSON) is a lightweight format used for structuring and interchanging data. AJAX allows to send and receive data from a server asynchronously. Combining the two, allows developers to use JSON to pass AJAX updates between the web application and the server.

JavaScript Object Notation (JSON) is a lightweight format used for structuring and interchanging data. AJAX allows to send and receive data from a server asynchronously. Combining the two, allows developers to use JSON to pass AJAX updates between the web application and the server.

What are the tools for debugging AJAX applications?

The tools that are most commonly used for debugging AJAX applications are:

  • Chrome developer tools. Enable “Log XMLHTTPRequests” in the Chrome console.
  • Fiddler for IE
  • Firebug for Mozilla.

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.