Ajax Interview Questions & Answers part 2

0
435

Q: – How is encoding handled in AJAX?

Ways to handle encoding in AJAX:

  • Using encodeActionURL() method to refresh the complete page
  • Using encodeResourceURL() method to partially update a page.

Q: – Describe how to handle concurrent AJAX requests ?

JavaScipt closures can be used for handling concurrent requests. A function can be written to handle such requests. Once processing of code is over, URL and the call back function to call can be passed as parameters. These parameters are passed to the AJAXInteraction(url, callback) object. Closures insure that the proper callback function associated with a specific AJAX interaction is called.

Q: – Describe how to handle concurrent AJAX requests ?

JavaScipt closures can be used for handling concurrent requests. A function can be written to handle such requests. Once processing of code is over, URL and the call back function to call can be passed as parameters. These parameters are passed to the AJAXInteraction(url, callback) object. Closures insure that the proper callback function associated with a specific AJAX interaction is called.

Q: – When do I use a synchronous versus a asynchronous request?

They don't call it AJAX for nothing! A synchronous request would block in page event processing and I don't see many use cases where a synchronous request is preferable.

Q: – Describe how to create AJAX objects.

Ajax Objects can be created by the following syntax: Var ajax= New ajaxObject(‘page path’). Here page path is the URL you want the Object to call. The URL must be of the same domain as the webpage.

Q: – What are limitations of Ajax?

Back functionality cannot work because the dynamic pages don’t register themselves to the browsers history engine. Hence the need of Iframe becomes essential.

  • The page cannot be bookmarked if implemented using Ajax.
  • If java script is disabled , Ajax will not work
  • Because different components of the pages are loaded at different times, response time may be slow.
  • Because different components of the pages are loaded at different times it may create confusion for the user.

Q: – What is the role of Script Manager in Ajax?

Script Manager, as the name suggests is used to manage the client side script of Ajax. Since Ajax uses Java Script, there needs to be a mediator to manage this script and restrict a particular version to a browser. A Script manager is present on every page where Ajax is used to enable the Ajax Libraries. These Libraries in turn helps to implement the core Functionality of Ajax: Partial rendering.

Q: – What is synchronous request in AJAX?

Synchronous request means that the processing will stop once the request has been sent to the server till the reply comes back. The browser freezes and you are not allowed to perform any task or send any request.

Q: – List out differences between AJAX and JavaScript.

JavaScript is a client-side script, used to control a web page at the client side once it has downloaded. The validations in case of JavaScript will be handled particularly on client’s browser and no server side requests will be handled. AJAX allows JavaScript to communicate with the remote script and receive the response from the server, without the need to reload the entire page. JavaScript is the base on which Ajax works.

Q: – Can Ajax be implemented in browsers that do not support the XmlHttpRequest object?

Yes. This is possible using remote scripts.

Q: – Explain about the multimedia functions of ajax?

Ajax lacks built in multimedia functions. It is not so supportive of inbuilt applications but uses other browser functionalities and plugin`s such as SVG, Quicktime and flash pugin. General multimedia for ajax is achieved through mashup and hack. These multimedia functions can be obtained from outside which helps in building excellent applications.

Q: – When should I use a Java applet instead of AJAX?

  • Applets provide features like custom data streaming, graphic manipulation, threading, and advanced GUIs which AJAX cannot.
  • However, with the help of DHTML, the functionalities of AJAX can be extended further.
  • AJAX requires that the browser be DHTML and AJAX capable.
  • AJAX-based functionality does need to take browser differences into consideration due to which using a JavaScript library such as Dojo which abstracts browser differences is recommended.
  • AJAX/DHTML works well for applications where the latest browsers are used.

Q: – What are Ajax Extensions?

The ASP.NET Ajax Extensions are set of Ajax-based controls that work in ASP.NET 2 (or above) based applications. Ofcourse,they also need the Ajax runtime which is actually the Ajax Framework 1.0. ASP.NET Ajax Extensions 1.0 have to be downloaded to run with ASP.NET 2.0 The new ASP.NET 3.5 Framework comes with the Ajax Library 3.5 (containing the Ajax Extensions 3.5). So in order to use the latest Ajax, simply download .NET 3.5 Framework.

Submitted By:-Rajender Sharma            Email-ID: – rajender.sharma@rediff.com

SHARE

LEAVE A REPLY