Interview Questions.

Top 100+ Ajax Interview Questions And Answers


Top 100+ Ajax Interview Questions And Answers

Question 1. What Is Ajax?

Answer :

AJAX (Asynchronous JavaScript and XML) is a newly coined term for 2 powerful browser functions which have been around for years, however were neglected via many web developers till currently while packages which includes Gmail, Google Suggest, and Google Maps hit the streets.

Ajax isn’t a technology. It’s absolutely several technology, each flourishing in its own proper, coming collectively in effective new ways. Ajax consists of:
* standards-based presentation the use of XHTML and CSS;
* dynamic show and interaction using the Document Object Model;
* records interchange and manipulation the usage of XML and XSLT;
* Asynchronous data retrieval the usage of XMLHttpRequest;
* JavaScript binding the entirety collectively.

Question 2. Who Is Using Ajax?

Answer :

Google is creating a large investment in developing the Ajax approach. All of the foremost merchandise Google has added during the last yr like Orkut, Gmail, the contemporary beta model of Google Groups, Google Suggest, and Google Maps are Ajax programs. (For greater at the technical nuts and bolts of those Ajax implementations, take a look at out those fantastic analyses of Gmail, Google Suggest, and Google Maps.) Others are following suit: many of the capabilities that human beings love in Flickr rely upon Ajax, and Amazon’s A9.Com seek engine applies comparable techniques.

These projects display that Ajax isn't handiest technically sound, however additionally realistic for real-global programs. This isn’t every other generation that handiest works in a laboratory. Ajax applications can be any size, from the quite simple, unmarried-characteristic Google Suggest to the very complicated and sophisticated Google Maps.

At Adaptive Path, we’ve been doing our very own paintings with Ajax during the last numerous months, and we’re knowing we’ve handiest scratched the surface of the wealthy interplay and responsiveness that Ajax programs can provide. Ajax is an crucial improvement for Web programs, and its significance is growing. The biggest demanding situations in creating Ajax packages are not technical. The center Ajax technologies are mature, stable, and properly understood. As there are such a lot of builders obtainable who already understand the way to use those technologies, we count on to see many extra companies following Google’s lead in reaping the competitive gain Ajax presents.

The challenges are for the designers of these packages to neglect what we assume we know approximately the restrictions of the Web, and begin to assume a wider, richer variety of opportunities

XML Interview Questions
Question 3. How Ajax Is Different?

Answer :

An Ajax utility eliminates the begin-forestall-start-stop nature of interplay on the Web with the aid of introducing an middleman — an Ajax engine — between the person and the server. It seems like adding a layer to the software might make it less responsive, however the contrary is genuine.

Instead of loading a webpage, on the start of the consultation, the browser masses an Ajax engine — written in JavaScript and typically tucked away in a hidden body. This engine is responsible for each rendering the interface the user sees and speaking with the server on the person’s behalf. The Ajax engine lets in the person’s interaction with the software to happen asynchronously — unbiased of verbal exchange with the server. So the person is never watching a clean browser window and an hourglass icon, waiting around for the server to do some thing.

The synchronous interaction sample of a conventional web utility (pinnacle) as compared with the asynchronous pattern of an Ajax application (bottom).

Every person movement that normally could generate an HTTP request takes the shape of a JavaScript name to the Ajax engine as an alternative. Any response to a consumer action that doesn’t require a ride returned to the server  including simple information validation, editing records in reminiscence, and even some navigation the engine handles on its own. If the engine wishes some thing from the server with a purpose to reply if it’s filing statistics for processing, loading extra interface code, or retrieving new statistics the engine makes those requests asynchronously, generally the usage of XML, without stalling a consumer’s interplay with the software.

Question four. Where Should I Start?

Answer :

Assuming the framework you're the usage of does not suffice your use cases and also you would like to expand your own AJAX additives or functionality I advocate you start with the item Asynchronous JavaScript Technology and XML (AJAX) With Java 2 Platform, Enterprise Edition. If you would really like to look a completely basic example that consists of supply code you can check out the tech tip Using AJAX with Java Technology. For a extra complete list of AJAX sources the Blueprints AJAX Home web page.Next, I could advocate spending a while investigating AJAX libraries and frameworks. If you choose to write down your own AJAX clients-facet script you are an awful lot better off now not re-inventing the wheel.

AJAX in Action by using Dave Crane and Eric Pascarello with Darren James is good resource. This ebook is helpful for the Java developer in that in carries an appendix for studying JavaScript for the Java developer.

XML Tutorial
Question five. Do Ajax Applications Always Deliver A Better Experience Than Traditional Web Applications?

Answer :

Not always. Ajax offers interaction designers extra flexibility. However, the greater energy we've got, the greater caution we should use in exercise it. We must be cautious to apply Ajax to decorate the person revel in of our packages, not degrade it.

HTML Interview Questions
Question 6. Are Ajax Applications Easier To Develop Than Traditional Web Applications?

Answer :

Not necessarily. Ajax applications necessarily contain walking complicated JavaScript code on the consumer. Making that complex code efficient and worm-free isn't a venture to be taken gently, and better improvement tools and frameworks might be needed to assist us meet that mission.

Question 7. Does Ajax Work With Java?

Answer :

Absolutely. Java is a amazing healthy for AJAX! You can use Java Enterprise Edition servers to generate AJAX customer pages and to serve incoming AJAX requests, manipulate server side state for AJAX customers, and join AJAX clients in your employer resources. The JavaServer Faces thing model is a tremendous in shape for outlining and the usage of AJAX components.

HTML Tutorial Java Script Interview Questions
Question 8. Do I Really Need To Learn Javascript?

Answer :

Basically yes in case you plan to increase new AJAX capability to your web software. On the alternative hand, JSF components and element libraries can abstract the details of JavaScript, DOM and CSS. These components can generate the important artifacts to make AJAX interactions viable. Visual tools consisting of Java Studio Creator may additionally use AJAX enabled JSF components to create applications, protective the tool developer from a few of the details of AJAX. If you plan to increase your personal JSF additives or cord the activities of components together in a tool it is crucial that you have a simple knowledge of JavaScript. There are consumer-aspect JavaScript libraries (discussed below) that you may call out of your in page JavaScript that abstract browser differences. Object Hierarchy and Inheritance in JavaScript is a superb aid for a Java developer to learn about JavaScript items.

Question 9. Won't My Server-facet Framework Provide Me With Ajax?

Answer :

You can be making the most of AJAX already. Many current Java primarily based frameworks have already got some level of AJAX interactions and new frameworks and issue libraries are being developed to provide better AJAX support. I may not listing all of the Java frameworks that use AJAX here, out of worry of missing a person, but you can discover a top listing at www.Ajaxpatterns.Org/Java_Ajax_Frameworks.

If you have not chosen a framework but it is encouraged you bear in mind the use of JavaServer Faces or a JavaServer Faces based totally framework. JavaServer Faces components may be created and used to summary the various info of producing JavaScript, AJAX interactions, and DHTML processing and consequently allow easy AJAX used by JSF application developer and as plug-ins in JSF like minded IDE's, consisting of Sun Java Studio Creator.

Android Interview Questions
Question 10. Did Adaptive Path Invent Ajax? Did Google? Did Adaptive Path Help Build Google's Ajax Applications?

Answer :

Neither Adaptive Path nor Google invented Ajax. Google’s recent merchandise are honestly the very best-profile examples of Ajax packages. Adaptive Path turned into not involved within the improvement of Google’s Ajax packages, but we had been doing Ajax work for a number of our different clients.

Java Script Tutorial
Question eleven. Is It Possible To Set Session Variables From Javascript?

Answer :

It's not viable to set any consultation variables at once from javascript as it is merely a client side technology. You can use AJAX although to asynchronously...

CSS Interview Questions
Question 12. Cannot Parse Xml Generated By Jsp I Am Generating An Xml Using Jsp, When I Run The Jsp In Ie It Shows The Xml As Per Dom, But When I Try To Parse It Using Javascript , The Command Xmldoc.Documentelement ?

Answer :

This is working code, it would assist you.
If (!IsIE)
xmldoc = req.ResponseXML;

//IE does no longer take the responseXML as.

XML Interview Questions
Question 13. What Do I Need To Know To Create My Own Ajax Functionality?

Answer :

If you intend now not to reuse and existing AJAX element, right here are some of the matters you will want to recognize.

Plan to learn Dynamic HTML (DHTML), the era that is the muse for AJAX. DHTML permits browser-base real time interaction among a user and an internet web page. DHTML is the aggregate of JavaScript, the Document Object Model (DOM) and Cascading Style Sheets (CSS).
JavaScript - JavaScript is a loosely typed item primarily based scripting language supported by means of all foremost browsers and critical for AJAX interactions. JavaScript in a web page is referred to as while an occasion in a page takes place which include a page load, a mouse click on, or a key press in a shape element.
DOM - An API for having access to and manipulating structured documents. In maximum cases DOM constitute the shape of XML and HTML documents.
CSS - Allows you to define the presentation of a page along with fonts, colorations, sizes, and positioning. CSS allow for a clean separation of the presentation from the content material and may be modified programmatically by means of JavaScript.
Understanding the basic request/reaction nature of HTTP is likewise important. Many subtle bugs can result if you forget about the differences between the GET and OIst methods while configuring an XMLHttpRequest and HTTP reaction codes while processing callbacks.

JavaScript is the consumer-facet glue, in a feel. JavaScript is used to create the XMLHttpRequest Object and trigger the asynchronous name. JavaScript is used to parse the lower back content material. JavaScript is used to research the back information and system returned messages. JavaScript is used to inject the brand new content into the HTML using the DOM API and to adjust the CSS.

Android Tutorial
Question 14. What Javascript Libraries And Frameworks Are Available?

Answer :

There are many libraries/frameworks out there (and many greater emerging) as a way to assist abstract such things as all the nasty browser differences. Three exact libraries are The Dojo Toolkit, Prototype, and DWR.

The Dojo Toolkit consists of APIs and widgets to assist the development of wealthy internet packages. Dojo incorporates an shrewd packaging system, UI consequences, drag and drop APIs, widget APIs, event abstraction, purchaser storage APIs, and AJAX interaction APIs. Dojo solves commonplace usability problems consisting of guide for managing the navigation such as the capacity to come across the browser lower back button, the capability to support adjustments to the URL in the URL bar for bookmarking, and the potential to gracefully degrade when AJAX/JavaScript is not fully aid on the patron. Dojo is the Swiss Army Knife of JavaScript libraries. It gives the widest variety of options in a unmarried library and it does a superb task supporting new and older browsers.
Prototype focuses on AJAX interactions consisting of a JavaScript AJAX item that incorporates some gadgets to do basic tasks which includes make a request, replace a part of a record, insert content material right into a report, and update a part of a record periodically. Prototype JavaScript library incorporates a set of JavaScript objects for representing AJAX requests and contains utility features for getting access to in page additives and DOM manipulations. Script.Aculo.Us and Rico are constructed on pinnacle of Prototype and offer UI consequences, help for drag and drop, and consist of common JavaScript centric widgets. If you're simply looking to aid AJAX interactions and some basic duties Prototype is high-quality. If you're seeking out UI effects Rico and Script.Aculo.Us are proper options.
DWR (Dynamic Web Remoting) is a client-facet and server-facet framework that specializes in permitting a developer to do RPC calls from patron-facet JavaScript to standard old Java gadgets in a Java Enterprise Edition net box. On the server side DWR makes use of a Servlet to have interaction with the Java items and returns object representations of the Java objects or XML documents. DWR can be easy to stand up and walking and performs nicely with other Java technology. If you're seeking out a purchaser-aspect and server-aspect framework that integrates nicely use DWR.
There are many new and emerging libraries for JavaScript and this list most effective opinions some of the extra not unusual libraries. When creating a choice choose the library which suites your desires the first-class. While it might be higher to select one, there's nothing stopping you from using more than one framework. For a more big list of customer-side frameworks see: Survey of AJAX/JavaScript Libraries.

Question 15. What Is The Difference Between Proxied And Proxyless Calls?

Answer :

Proxied calls are made thru stub gadgets that mimic your PHP lessons at the JavaScript side. E.G., the helloworld magnificence from the Hello World example.

Proxyless calls are made the usage of application javascript functions like HTML_AJAX.Replace() and HTML_AJAX.Append().

Web Developer Guide Interview Questions
Question sixteen. Should I Use Xml Or Text, Javascript, Or Html As A Return Type?

Answer :

It relies upon. Clearly the 'X' in AJAX stands for XML, but numerous AJAX proponents are quick to point out that not anything in AJAX, in step with se, precludes the usage of different types of payload, inclusive of, JavaScript, HTML, or undeniable textual content.

XML - Web Services and AJAX appear made for one another. You can use client-aspect API's for downloading and parsing the XML content material from RESTful Web Services. (However remember with a few SOAP primarily based Web Services architectures he payloads can get quite big and complex, and therefore may be inappropriate with AJAX techniqes.)
Plain Text - In this case server-generated textual content may be injected right into a record or evaluated with the aid of client-aspect good judgment.
JavaScript - This is an extension to the plain textual content case with the exception that a server-side aspect passes a fraction of JavaScript inclusive of JavaScript item declarations. Using the JavaScript eval() feature you could then create the items on the client. JavaScript Object Notation (JSON), that's a JavaScript object primarily based records exchange specification, relies in this technique.
HTML - Injecting server-generated HTML fragments immediately right into a record is commonly a completely powerful AJAX technique. However, it may be complex retaining the server-aspect issue in sync with what is displayed on the customer.
Mashup is a famous time period for creating a very new net software via combining the content material from disparate Web Services and different online API's. A accurate instance of a mashup is housingmaps.Com which graphically combines housing need-ads from craiglist.Org and maps from maps.Google.Com.

CSS Tutorial
Question 17. Are There Usability Issues With Ajax?

Answer :

The nature of updating a page dynamically using information retrieved via AJAX interactions and DHTML might also result in notably converting the arrival and state of a page. A consumer might choose to use the browser's lower back or ahead buttons, bookmark a web page, copy the URL from the URL bar and proportion it with a friend via an email or chat patron, or print a page at any given time. When designing an AJAX based totally application you need to consider what the expected conduct could be in the case of navigation, bookmarking, printing, and browser guide as described below.

Navigation - What will be the predicted behavior of the again, forward, refresh, and bookmark browser buttons to your software layout. While you could enforce records manipulation manually it can be easer to apply a JavaScript frameworks including Dojo that gives API's history manipulation and navigation manage.
Bookmarking and URL sharing - Many customers want to bookmark or reduce and paste the URL from the browser bar. Dojo presents patron-side for bookmarking and URL manipulation.
Printing - In a few instances printing dynamically rendered pages can be complicated.
Other concerns as a developer when the use of AJAX are:

Browser Support - Not all AJAX/DHTML capabilities are supported on all browsers or all variations of a browser. See quirksmode.Org for a list of browser aid and possible workarounds.
JavaScript disabled - You need to additionally don't forget what occurs if the consumer disables JavaScript. Additionally, there are numerous legitimate reasons why JavaScript and CSS help may be unavailable on a user's web browser.
Latency - Keep in thoughts latency to your design. A walking software might be much extra responsive than while it's miles deployed.
Latency problems: fantasy or truth?
Accessibility - Guaranteeing your web site is out there to humans with disabilities isn't always most effective a noble intention, it is also requited via law in lots of markets. Some superb enabling generation is available to help people use the Web regardless of disabilities together with visual, auditory, physical, speech, cognitive, and neurological disabilities. With a touch forethought, and comprehension of some well documented satisfactory practices, you could assure that your software is well suited with that enabling technology.
Degradability is the time period used to describe techniques utilized by net applications to evolve to the wide range of net browser capabilities. Many AJAX libraries have automatic degradability constructed in. But in case you are coding your own custom AJAX capability, genuinely taking a few care to observe the excellent practices promoted through requirements bodies just like the World Wide Web Consortium (W3C), and grass root moves just like the Web Standards community and plenty of others, your utility can run usefully on browsers which are incapable of AJAX behaviors. Granted, your utility might also unfastened some of the "wow factor" on those much less capable browsers, however your application will still be usable.

Remember to not design with AJAX only for the sake of coolness. The cause you constructed your utility is so human beings will use it. And human beings will now not use your utility in case your application isn't well suited with their web browser.

XSLT Interview Questions
Question 18. Are There Any Frameworks Available To Help Speedup Development With Ajax?

Answer :

There are numerous browser-side frameworks to be had, each with their personal strong point...

HTML Interview Questions
Question 19. Is Adaptive Path Selling Ajax Components Or Trademarking The Name? Where Can I Download It?

Answer :

Ajax isn’t some thing you can download. It’s an technique — a way of thinking about the architecture of net packages using positive technology. Neither the Ajax call nor the approach is proprietary to Adaptive Path.

Web Developer Guide Tutorial
Question 20. Should I Use An Http Get Or Post For My Ajax Calls?

Answer :

AJAX requests need to use an HTTP GET request when retrieving information in which the facts will not trade for a given request URL. An HTTP POST should be used whilst country is up to date at the server. This is in keeping with HTTP idempotency guidelines and is distinctly recommended for consistent web application structure.

Java XML Interview Questions
Question 21. How Do We Debug Javascript?

Answer :

There are not that many equipment out there on the way to guide both purchaser-facet and server-aspect debugging. I am certain this may trade as AJAX applications proliferate. I presently do my patron-facet and server-aspect debugging one after the other. Below is a few records at the customer-facet debuggers on some of the commonly used browsers.

Firefox/Mozilla/Netscape - Have a built in debugger Venkman which can be useful however there's a Firefox upload on referred to as FireBug which gives all of the statistics and AJAX developer could ever need inclusive of the capability to look into the browser DOM, console get entry to to the JavaScript runtime inside the browser, and the capacity to see the HTTP requests and responses (consisting of the ones made by means of an XMLHttpRequest). I have a tendency to broaden my applications to begin with on Firefox the usage of Firebug then undertaking out to the opposite browsers.
Safari - Has a debugger which needs to be enabled. See the Safari FAQ for details.
Internet Explorer - There is MSDN Documentation on debugging JavaScript. A developer toolbar for Internet Explorer will also be helpful.
While debuggers assist a not unusual approach knowing as "Alert Debugging" may be used. In this example you location "alert()" feature calls inline similar to you will a System.Out.Println. While a little primitive it works for most basic instances. Some frameworks which include Dojo provide APIs for tracking debug statements.

Question 22. How Do I Provide Internationalized Ajax Interactions?

Answer :

Just due to the fact you're using XML does not suggest you can properly ship and obtain localized content material the use of AJAX requests. To offer internationalized AJAX components you want to do the subsequent:

Step 1. Set the charset of the web page to an encoding that is supported by your target languages. I have a tendency to apply UTF-8 because it covers the most languages. The following meta declaration in a HTML/JSP page will set the content material kind:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Step 2.In the web page JavaScript make sure to encode any parameters despatched to the server. JavaScript provides the break out() function which returns Unicode break out strings in which localized textual content will seem in hexadecimal format. For greater info on JavaScript encoding seeComparing get away(), encodeURI(), and encode URI Component().

Step three. On the server-side element set the person encoding using the HttpServletRequest.SetCharacterEncoding() method. Before you get entry to the localized parameter the usage of the HttpServletRequest.GetParameter() name. In the case of UTF this would be request .Set Characther Encoding ("UTF-8");.

A server-aspect thing returning AJAX responses desires to set the encoding of the reaction to the same encoding used within the web page.

Response.SetContentType("textual content/xml;charset=;UTF-8");
reaction.GetWriter().Write(" <response>invalid  </response>");
For more information on the usage of AJAX with Java Enterprise Edition technologies see AJAX and Internationalization and for developing multi-lingual programs see Developing Multilingual Web Applications Using JavaServer Pages Technology.

Java XML Tutorial
Question 23. Some Of The Google Examples You Cite Don't Use Xml At All. Do I Have To Use Xml And/or Xslt In An Ajax Application?

Answer :

No. XML is the most fully-evolved method of having records inside and out of an Ajax consumer, but there’s no purpose you couldn’t accomplish the identical outcomes using a generation like JavaScript Object Notation or any similar way of structuring facts for interchange.

XMLHttpRequest (XHR) Interview Questions
Question 24. When Do I Use A Synchronous Versus Asynchronous Request?

Answer :

 They do not name it AJAX for nothing! A synchronous request might block in web page occasion processing and I do not see many use cases wherein a synchronous request is finest.

Java Script Interview Questions
Question 25. How Do I Handle Concurrent Ajax Requests?

Answer :

With JavaScript you may have more than one AJAX request processing at a unmarried time. In order to insure the proper publish processing of code it is recommended that you use JavaScript Closures. The example below shows an XMLHttpRequest item abstracted by using a JavaScript item referred to as AJAXInteraction. As arguments you skip inside the URL to name and the characteristic to call whilst the processing is finished.

Characteristic AJAXInteraction(url, callback) 
var req = init();
req.Onreadystatechange =  processRequest;

unction init() 
if  (window.XMLHttpRequest) 
return new  XMLHttpRequest();
 else if  (window.ActiveXObject) 
return new  ActiveXObject("Microsoft.XMLHTTP");

function processRequest  () 
if (req.ReadyState ==  4) 
if (req.Status ==  2 hundred) 
if (callback)  callback(req.ResponseXML);

this.DoGet = feature()  
req.Open("GET", url, genuine);

this.DoPost =  function(frame) 
req.Open("POST", url, proper);
req.SetRequestHeader("Content-Type",  "

characteristic makeRequest() 
var ai = new  AJAXInteraction("processme", 
function()   alert("Doing Post Process"););

The characteristic makeRequest() in the example above creates an AJAXInteraction with a URL to of "processme" and an inline characteristic that will show an alert conversation with the message "Doing Post Process". When ai.DoGet() is known as the AJAX interaction is initiated and while server-facet component mapped to the URL "processme" returns a report that's surpassed to the callback function that become detailed when the AJAXInteraction changed into created.

Using this closures insures that the right callback feature associated with a particular AJAX interaction is referred to as. Caution need to still be taken whilst creating multiple closure gadgets in that make XmlHttpRequests as to there is a confined variety of sockets that are used to make requests at any given time. Because there are restricted quantity of requests that may be made concurrently. Internet Explorer for instance most effective lets in for two concurrent AJAX requests at any given time. Other browsers can also permit greater however it is commonly among 3 and 5 requests. You may pick out to use pool of AJAXInteraction objects.

One aspect to note when making multiple AJAX calls from the patron is that the calls aren't assured to go back in any given order. Having closures in the callback of a closure item can be used to make certain dependencies are processed effectively. There is a discussion titled Ajaxian Fire and Forget Pattern this is useful.

JSON (JavaScript Object Notation) Tutorial
Question 26. What Do I Do On The Server To Interact With An Ajax Client?

Answer :

The "Content-Type" header needs to be set to"textual content/xml". In servlets this could be finished the usage of the HttpServletResponse.SetContentType()have to be set to "textual content/xml" when the go back type is XML. Many XMLHttpRequest implementations will result in an blunders if the "Content-Type" header is ready The code beneath suggests the way to set the "Content-Type".

You may also need to set whether or not or now not to set the caches header for cases which includes autocomplete in which you could need to inform proxy servers/and browsers no longer to cache the outcomes.

reaction.SetHeader("Cache-Control", "no-cache");
Note to the developer: Internet Explorer will automatically use a cached result of any AJAX response from a HTTP GET if this header isn't always set that may make matters difficult for a developer. During improvement mode you can need set this header. Where do I keep country with an AJAX purchaser

As with different browser primarily based web programs you have a few options which include:

On the client in cookies - The length is restricted (usually around 4KB X 20 cookies consistent with area so a complete of 80KB) and the content material may not be comfortable except encrypted which is hard but not impossible the usage of JavaScript.
On the consumer inside the page - This may be executed securely but can be complex and tough to paintings with. See my blog entry on Storing State at the Client for greater info in this subject matter.
On the customer record machine - This may be carried out if the customer presents get entry to to the browser to put in writing to the local record machine. Depending on your uses cases this could be necessary however caution is advised.
On the Server - This is in the direction of the conventional model where the consumer view is of the nation on the server. Keeping the statistics in sync may be a bit difficult and for that reason we've an answer Refreshing Data in this. As more records processing and control actions to the purchaser where state is stored will need to be re-evaluated.
JSON (JavaScript Object Notation) Interview Questions
Question 27. Whats With The -alpha In The Install Instructions?

Answer :

HTML_AJAX hasn't had a solid launch yet and the pear installer does not installation non solid applications by using default except you specify a version.

Android Interview Questions
Question 28. How Do I Submit A Form Or A Part Of A Form Without A Page Refresh?

Answer :

When creating a form make certain that the "shape" detail "onSubmit" attribute is set to a JavaScript characteristic that returns false. 

<form onSubmit="doAJAXSubmit();return false;" >
<input type="text" id="tf1" />
<input type="submit" id="submit1"  value="Update"/>
You can also submit statistics by means of associating a characteristic with a form button in a similar manner.

<form onSubmit="doAJAXSubmit();return false;" >
<input type="text" id="tf1" />
<input type="button" id="button1"  onClick="doAJAXSubmit()" value="Update"/>
Note that the form "onSubmit" characteristic is still set. If the consumer hits the input key within the text area the shape will be submitted so you nonetheless want to address that case.

When updating the page it's far endorse you wait to make certain that the AJAX replace of the shape statistics was successful earlier than updating the records within the page. Otherwise, the records won't well update and the consumer won't know. I like to offer an informative message when doing a partial replace and upon a a hit AJAX interaction I will then replace the page.

XML DOM Tutorial
Question 29. How Do I Test My Ajax Code?

Answer :

There is a port of JUnit for client-side JavaScript known as JsUnit.

XML DOM Interview Questions
Question 30. What Exactly Is The W3c Dom?

Answer :

The W3C Document Object Model (DOM) is defined by means of the W3C as the following: The Document Object Model is a platform- and language-neutral interface.

Question 31. When Will Html_ajax Have A Stable Release?

Answer :

Once all the foremost features are entire and the API has been examined, the roadmap gives an idea of what's left to be accomplished.

Question 32. What Parts Of The Html_ajax Api Are Stable?

Answer :

We do not have a list proper now, however maximum of the API is solid as of zero.3.Zero. There need to be no fundamental modifications at this factor, though there may be plenty of latest additions.

Question 33. What Browsers Does Html_ajax Work With?

Answer :

We do not have a listing proper now, however maximum of the API is solid asAs of zero.3.Zero, all of the examples that deliver with HTML_AJAX have been established to work with

Firefox 1.0+
Internet Explorer five.5+ (5.0 have to work however it hasn't been examined)
Most things paintings with

Safari 2+
Opera eight.Five+ of 0.3.0. There need to be no fundamental adjustments at this point, even though there will be masses of recent additions.
CSS Interview Questions
Question 34. Is The Server Or The Client In Control?

Answer :

It relies upon. With AJAX the solution is greater in among. Control may be more centralized in a server-aspect element or as a mix of customer-side and server-side controllers.

Centralized server-aspect controller - When having a more centralized controller the key's to make sure the facts in customer-aspect page is in sync with that of the server. Some packages may additionally hold all of the state at the server and push all updates to purchaser DOM through a easy JavaScript controller.
Client and server-side controllers - This structure would use JavaScript to do all presentation associated manage, occasion processing, web page manipulation, and rendering of model records at the purchaser. The server-side would be answerable for things including commercial enterprise logic and pushing updated version information to the purchaser. In this example the server could not have intimate know-how of the presentation quick of the preliminary web page that would be despatched to the patron web page request.
There are a few use cases in which an entire AJAX utility can be written in a single page. Keep in mind in case you select this form of structure that navigation and bookmarking ought to be taken into consideration.

Both strategies are possible relying on what you are attempting to accomplish. I tend to choose spreading the manipulate throughout the customer and server.

Question 35. Is Ajax Just Another Name For Xmlhttprequest?

Answer :

No. XMLHttpRequest is simplest a part of the Ajax equation. XMLHttpRequest is the technical thing that makes the asynchronous server communique feasible; Ajax is our name for the general method described in the article, which is predicated not only on XMLHttpRequest, however on CSS, DOM, and different technology.

Question 36. How Do I Abort The Current Xmlhttprequest?

Answer :

Just call the abort() method on the request.

Web Developer Guide Interview Questions
Question 37. What Is The Minimum Version Of Php That Needs To Be Running In Order To Use Html_ajax?

Answer :

The oldest PHP model i have fully examined HTML_AJAX is four.Three.11, however it must run on four.2.Zero without any troubles. (Testing reviews from PHP versions older then four.3.11 would be favored.)

Question 38. Why Does Html_ajax Hang On Some Server Installs?

Answer :

If you run into an HTML_AJAX hassle most effective on a few servers, probabilities are your strolling into a hassle with output compression. If the output compression is treated inside the PHP config we locate that and do the proper aspect, but if its finished from an apache extension we haven't any manner of understanding its going to compress the frame. Some times putting HTML_AJAX::sendContentLength to false fixes the problem, but in different cases you'll need to disabled the extension for the AJAX pages.

I've additionally visible issues caused by debugging extensions like XDebug, disabling the extension at the server page usually fixes that. Questions dealing with Using HTML_AJAX, and wellknown JavaScript development

Question 39. How Do We Get The Xmlhttprequest Object?

Answer :

Depending upon the browser...

If (window.ActiveXObject) 
// Internet Explorer http_request = new  ActiveXObject("Microsoft.XMLHTTP"); 

else if.
Question 40. Are There Any Security Issues With Ajax?

Answer :

JavaScript is in plain view to the user with with the aid of choosing view source of the web page. JavaScript can't get admission to the neighborhood report gadget without the person's permission. An AJAX interplay can best be made with the servers-side aspect from which the web page was loaded. A proxy sample could be used for AJAX interactions with external offerings.

You want to be cautious not to show your software version in inclusive of manner that your server-side additives are at danger if a nefarious user to opposite engineer your application. As with any other internet application, don't forget the use of HTTPS to relaxed the relationship when personal information is being exchanged.

XSLT Interview Questions
Question 41. What About Applets And Plugins?

Answer :

Don't be too short to dump your plugin or applet based totally quantities of your utility. While AJAX and DHTML can do drag and drop and different advanced consumer interfaces there still limitations specially with regards to browser guide. Plugins and applets were round for some time and were able to make AJAX like requests for years. Applets provide a high-quality set of UI additives and APIs that provide developers actually anything.

Many humans push aside applets or plugins due to the fact there is a startup time to initialize the plugin and there is no guarantee that the wanted model of a plugin of JVM is set up. Plugins and applets won't be as able to manipulating the web page DOM. If you are in a uniform environment or can depend upon a selected JVM or plugin version being to be had (including in a company surroundings) a plugin or applet answer is excellent.

One issue to don't forget is a mixture of AJAX and applets or plugins. Flickr uses a ombination of AJAX interactions/DHTML for labeling photographs and user interaction and a plugin for manipulating images and photo sets to provide a brilliant user experience. If you design your server-side components properly they can communicate to both sorts of clients.

Question 42. Is Ajax Code Cross Browser Compatible?

Answer :

Not completely. Most browsers offer a native XMLHttpRequest JavaScript item, whilst every other one (Internet Explorer) require you to get it as an ActiveX object....

Java XML Interview Questions
Question forty three. Techniques For Asynchronous Server Communication Have Been Around For Years. What Makes Ajax A "new" Approach?

Answer :

What’s new is the prominent use of these strategies in actual-global packages to change the fundamental interplay version of the Web. Ajax is taking preserve now because these technologies and the enterprise’s expertise of a way to installation them maximum correctly have taken time to increase.

Question 44. Is Ajax A Technology Platform Or Is It An Architectural Style?

Answer :

It’s each. Ajax is a set of technology being used together in a selected way.

Question 45. How Do I Handle The Back And Forward Buttons?

Answer :

While you may exit and create a custom solution that tracks the cutting-edge state in your application I propose you go away this to the professionals. Dojo addresses the navigation in a browser neutral manner as may be visible inside the JavaScript example underneath.

Feature updateOnServer(oldId, oldValue, 
itemId, itemValue) 
var bindArgs = 
url:  "faces/ajax-dlabel-update",
approach: "publish",
content material: "component-identification": itemId, "component-price":
mimetype: "textual content/xml",
load: feature(type, records) 
backButton: feature() 
alert("old itemid become " + oldId);
forwardButton: characteristic()
alert("forward we must cross!");


The instance above will replace a price at the server using dojo.Io.Bind() with a function as a assets that is responsible for dealing with the browser back button occasion. As a developer you are capable of restoring the cost to the oldValue or taking every other action which you see match. The underlying info of ways the how the browser button event are detected are hidden from the developer by way of Dojo.

AJAX: How to Handle Bookmarks and Back Buttons information this problem and gives a JavaScript library Really Simple History framework (RSH) that focuses just at the again and ahead issue.

Question forty six. How Does Html_ajax Compare With The Xajax Project At Sourceforge?

Answer :

XAJAX uses XML as a transport for information between the webpage and server, and you do not write your personal javascript facts handlers to govern the information received from the server. Instead you use a personal home page class and built in javascript techniques, a aggregate that works very similiar to the HTML_AJAX_Action class and haSerializer blend. XAJAX is designed for simplicity and ease of use.

HTML_AJAX lets in for more than one transmission types in your ajax statistics - along with urlencoding, json, phpserialized, simple text, with others deliberate, and has a machine you can use to jot down your own serializers to fulfill your precise wishes. HTML_AJAX has a class to assist generate javascript (HTML_AJAX_Helper) similiar to ruby on rail's javascript helper (even though it is not complete), and an movement system similiar to XAJAX's "movement pump" that permits you to keep away from writing javascript statistics handlers in case you preference.

But it also has the capability to put in writing your very own records managing workouts, automatically sign up lessons and methods the usage of a server "proxy" script, do one of a kind kinds of callbacks along with grabbing faraway urls, select between sync and async requests, has iframe xmlhttprequest emulation fallback competencies for customers with vintage browsers or disabled activeX, and is in active development with extra capabilities deliberate (see the Road Map for information)

HTML_AJAX has extra features which include consumer pooling and priority queues for extra superior users, or even a javascript application elegance. Although you may use HTML_AJAX the identical manner you use XAJAX, the extra capabilities make it more robust, extensible and bendy. And it's far a pear package deal, you could use the pear installer to both install and maintain it updated.

If you're asking that's "higher" - as with maximum Hypertext Preprocessor scripts it is a count number of taste and need. Do you want a brief, simple ajax solution? Or do you need some thing it really is bendy, extensible, and looking to comprise even more exceptional functions? It relies upon on the project, you as a writer, and your destiny plans.

Question 47. What Browsers Support Ajax?

Answer :

Internet Explorer 5.Zero and up, Opera 7.6 and up, Netscape 7.1 and up, Firefox 1.0 and up, Safari 1.2 and up, amongst others.

Question 48. How Do I Send An Image Using Ajax?

Answer :

While it can appear that snap shots are being sent whilst the usage of AJAX with an utility like Google Maps what is simply happening is that the URLs of photos are being ship because the reaction of an AJAX request and people URLs are being set the usage of DHTML.

In this case an XML document is lower back from an AJAX interaction and the class bar is populated.

<description>Fun to examine</description>
<description>Must have devices</description>
Notice that the image-url detail includes the area of the URL for the image representing a class. The callback approach of an AJAX interaction will parse the reaction XML file and speak to the addCategory function for every class blanketed in the response XML record. The addCategory characteristic seems up a table row element "categoryTable" in body of the page and adds a row to the detail which incorporates the photo.

<scrip type="text/javascript" >
Function addCategory(id, name, imageSrc) 
var categoryTable = report.GetElementById("categoryTable");
var row = document.CreateElement("tr");
var catCell = file.CreateElement("td");
var img = document.CreateElement("img");
img.Src = ("photos" + imageSrc);
var link = document.CreateElement("a");
link.ClassName ="class";
hyperlink.SetAttribute("onclick", "catalog?Command=class&catid=" + identity);

<td width="300" bgoclor="lightGray">
<table id="categoryTable" border="0" cellpadding="0"></table>
<td id="body" width="100%">Body Here</td>
Note that the source of the photograph is ready to the image supply. The image is loaded by way of a next HTTP request for the picture at the URL "photos/books_icon.Gif" or "photos/electronic_icon.Gif" that takes place whilst the img detail is brought to the categoryTable.

Question 49. Will Html_ajax Integrate With Other Javascript Ajax Libraries Such As Scriptaculous? How Would This Integration Look Like?

Answer :

HTML_AJAX would not have specific plans to integrate with other JavaScript libraries. Part of this is because outside dependencies make for a extra complicated installation system. It may make experience to provide some non-obligatory dependencies on a library like scriptaculous robotically using its visible consequences for the loading field or some thing, but there is not a lot to gain from making default visuals like that flashier on account that they may be designed to be asily replaceable.

Most integration might take area in higher level additives. Its uncertain whether higher level components like that have to be a part of HTML_AJAX delivered through PEAR or in the event that they need to just be supported with the aid of HTML_AJAX and made to be had from http://htmlajax.Org or a few other web site. If your interested in building widgets or components based on HTML_AJAX please let me recognise.

HTML_AJAX does but offer the ability to use its library loading mechanism with any JavaScript library. I use scriptaculous along side HTML_AJAX and I load each libraries through the server.

To do this you just want to sign up the library together with your server and cargo add its flag on your include line.

<script type="text/javascrpt" src="server.Php?Client=scriptaculous">
Question 50. When Should I Use A Java Applet Instead Of Ajax?

Answer :

Applets offer capabilities like custom records streaming, photograph manipulation, threading, and superior GUIs which AJAX can not.
However, with the assist of DHTML, the functionalities of AJAX may be extended in addition.
AJAX requires that the browser be DHTML and AJAX succesful.
AJAX-based totally capability does need to take browser variations into consideration due to which the usage of a JavaScript library together with Dojo which abstracts browser differences is recommended.
AJAX/DHTML works nicely for applications where the cutting-edge browsers are used.
Question 51. What Kinds Of Applications Is Ajax Best Suited For?

Answer :

We don’t know yet. Because that is a particularly new technique, our knowledge of in which Ajax can nice be carried out continues to be in its infancy. Sometimes the traditional internet utility model is the most appropriate solution to a problem.

Question 52. Does This Mean Adaptive Path Is Anti-flash?

Answer :

Not in any respect. Macromedia is an Adaptive Path purchaser, and we’ve long been supporters of Flash era. As Ajax matures, we assume that every now and then Ajax may be the higher technique to a selected trouble, and from time to time Flash could be the better solution. We’re also interested in exploring ways the technologies may be mixed (as within the case of Flickr, which makes use of both).

Question 53. Where Can I Find Examples Of Ajax?

Answer :

While components of AJAX had been around for a while (for instance, 1999 for XMLHttpRequest), it definitely failed to turn out to be that famous till Google took. But Global Guide Line guide all of its visitors to study AJAX from absolute newbie to develop level.

Question 54. What Is The Xmlhttprequest Object?

Answer :

It offers a non-blocking manner for JavaScript to talk again to the net server to replace most effective a part of the web web page.

Question 55. Does Ajax Have Significant Accessibility Or Browser Compatibility Limitations? Do Ajax Applications Break The Back Button? Is Ajax Compatible With Rest? Are There Security Considerations With Ajax Development? Can Ajax Applications Be Made To Work For Users Who Have Javascript Turned Off?

Answer :

The solution to all of these questions is “maybe”. Many builders are already working on ways to deal with those worries. We assume there’s more paintings to be finished to determine all the limitations of Ajax, and we expect the Ajax improvement community to uncover more problems like these along the manner.

Question 56. How Do I Access Data From Other Domains To Create A Mashup With Java?

Answer :

From your JavaScript clients you can get admission to records in other domain names if the go back statistics is offer in JSON layout. In essence you could create a JavaScript client that runs operates the use of statistics from a special server. This method is realize as JSON with Padding or JSONP. There are questions as to whether this method is comfortable as you are retrieving statistics from outdoor your area and allowing it to be excuted inside the context of your area. Not all information from 0.33 events is offered as JSON and in some instances you could need a further stage of protection. With Java you could provide a proxy to third birthday celebration services the usage of an internet thing such as a servlet. This proxy can manage the conversation with a third celebration provider and offer the data for your clients in a layout of your selecting. You also can cache facts at your proxy and reduce journeys to carrier. For greater on the use of a Java proxy to create mashups see The XmlHttpProxy Client for Java.

Question 57. Does Java Have Support For Comet Style Server-aspect Push?

Answer :

Current AJAX packages use polling to talk changes information between the server and customer. Some applications, together with chat applications, inventory tickers, or score forums require more immediately notifications of updates to the purchaser. Comet is an occasion based totally low latency server side push for AJAX applications. Comet conversation keeps one of the two connections available to the browser open to constantly communicate occasions from the server to the client. A Java based totally solution for Comet is being developed for Glassfish on top of the Grizzly HTTP connector. See Enabling Grizzly by way of Jean-Francois Arcand for more info.

Question fifty eight. How Do We Create A Thread To Do Ajax Polling?

Answer :

JavaScript does not have threads. JavaScript functions are known as while an event takes place in a page together with the page is loaded, a mouse click, or a shape detail gains cognizance. You can create a timer using the set Timeout which takes a feature name and time in milliseconds as arguments. You can then loop by means of calling the identical function as may be seen within the JavaScript example underneath.

Function checkForMessage() 
// begin AJAX interaction with processCallback because the callback function

// callback for the request
feature processCallback() 
// do post processing
setTimeout("checkForMessage()", 10000);

Notice that the checkForMessage will keep to loop indefinitely. You might also need to vary the increment the c program languageperiod primarily based on pastime inside the web page or your use instances. You may pick out to have good judgment that might break out of the loop primarily based on some AJAX reaction processing circumstance.

Question fifty nine. Is The Xmlhttprequest Object Part Of A W3c Standard?

Answer :

No. Or not but. It is part of the DOM Level three Load and Save Specification suggestion.

Question 60. How Does One Call A Javascript Function From The Ajax Code?

Answer :

Ajax is a shape of JavaScript, which makes use of XML Http Request objects that take movement event parameters into a way called “open”. The term AJAX symbolizes Asynchronous Java script and XML, in which there's no order in which the requests and responses are tracked.”XMLHttpRequest.Open” takes action events as URL Parameters. On the other hand, “XMLHttp Request.Ship” sends the Request item both asynchronously or synchronously, relying on whether the option for the synchronous model is true or false.

Question 61. Can You List Some Examples Of Ajax-based totally Applications?

Answer :

Some applications and scenarios in which AJAX is utilized include login paperwork, auto-complete (e,g. Google seek ),