• +91 9971497814
  • info@interviewmaterial.com

Computer Interview Questions Answers

Ajax Interview Questions Answers

Question - 41 : - What is the difference between proxied and proxyless calls?

Answer - 41 : - Proxied calls are made through stub objects that mimic your PHP classes on the JavaScript side. E.g., the helloworld class from the Hello World example. Proxyless calls are made using utility javascript functions like HTML_AJAX.replace() and HTML_AJAX.append().

Question - 42 : - Is AJAX code cross browser compatible?

Answer - 42 : - Not totally. Most browsers offer a native XMLHttpRequest JavaScript object, while another one (Internet Explorer) require you to get it as an ActiveX object....

Question - 43 : - Are there any frameworks available to help speedup development with AJAX?

Answer - 43 : - There are several browser-side frameworks available, each with their own uniqueness...

Question - 44 : - How do I get the XMLHttpRequest object?

Answer - 44 : - Depending upon the browser... if (window.ActiveXObject) { // Internet Explorer http_request = new ActiveXObject("Microsoft.XMLHTTP"); } else if...

Question - 45 : - Whats with the -alpha in the install instructions?

Answer - 45 : - HTML_AJAX hasn't had a stable release yet and the pear installer doesn't install non stable packages by default unless you specify a version.

Question - 46 : - How do I access data from other domains to create a mashup with Java?

Answer - 46 : - From your JavaScript clients you can access data in other domains if the return data is provide in JSON format. In essence you can create a JavaScript client that runs operates using data from a different server. This technique is know as JSON with Padding or JSONP. There are questions as to whether this method is secure as you are retrieving data from outside your domain and allowing it to be excuted in the context of your domain. Not all data from third parties is accessible as JSON and in some cases you may want an extra level of protection. With Java you can provide a proxy to third party services using a web component such as a servlet. This proxy can manage the communication with a third party service and provide the data to your clients in a format of your choosing. You can also cache data at your proxy and reduce trips to service. For more on using a Java proxy to create mashups see The XmlHttpProxy Client for Java.

Question - 47 : - What do I need to know to create my own AJAX functionality?

Answer - 47 : - If you plan not to reuse and existing AJAX component here are some of the things you will need to know. Plan to learn Dynamic HTML (DHTML), the technology that is the foundation for AJAX. DHTML enables browser-base real time interaction between a user and a web page. DHTML is the combination of JavaScript, the Document Object Model (DOM) and Cascading Style Sheets (CSS). * JavaScript - JavaScript is a loosely typed object based scripting language supported by all major browsers and essential for AJAX interactions. JavaScript in a page is called when an event in a page occurs such as a page load, a mouse click, or a key press in a form element. * DOM - An API for accessing and manipulating structured documents. In most cases DOM represent the structure of XML and HTML documents. * CSS - Allows you to define the presentation of a page such as fonts, colors, sizes, and positioning. CSS allow for a clear separation of the presentation from the content and may be changed programmatically by JavaScript. Understanding the basic request/response nature of HTTP is also important. Many subtle bugs can result if you ignore the differences between the GET and OIst methods when configuring an XMLHttpRequest and HTTP response codes when processing callbacks. JavaScript is the client-side glue, in a sense. JavaScript is used to create the XMLHttpRequest Object and trigger the asynchronous call. JavaScript is used to parse the returned content. JavaScript is used to analyze the returned data and process returned messages. JavaScript is used to inject the new content into the HTML using the DOM API and to modify the CSS.

Question - 48 : - Does this mean Adaptive Path is anti-Flash?

Answer - 48 : - Not at all. Macromedia is an Adaptive Path client, and we’ve long been supporters of Flash technology. As Ajax matures, we expect that sometimes Ajax will be the better solution to a particular problem, and sometimes Flash will be the better solution. We’re also interested in exploring ways the technologies can be mixed (as in the case of Flickr, which uses both).

Question - 49 : - How do I create a thread to do AJAX polling?

Answer - 49 : - JavaScript does not have threads. JavaScript functions are called when an event happens in a page such as the page is loaded, a mouse click, or a form element gains focus. You can create a timer using the setTimeout which takes a function name and time in milliseconds as arguments. You can then loop by calling the same function as can be seen in the JavaScript example below. function checkForMessage() { // start AJAX interaction with processCallback as the callback function } // callback for the request function processCallback() { // do post processing setTimeout("checkForMessage()", 10000); } Notice that the checkForMessage will continue to loop indefinitely. You may want to vary the increment the interval based on activity in the page or your use cases. You may also choose to have logic that would break out of the loop based on some AJAX response processing condition.

Question - 50 : - Should I use an HTTP GET or POST for my AJAX calls?

Answer - 50 : - AJAX requests should use an HTTP GET request when retrieving data where the data will not change for a given request URL. An HTTP POST should be used when state is updated on the server. This is in line with HTTP idempotency recommendations and is highly recommended for a consistent web application architecture.

Computer Contributors

Rajeev Katiyar
Yes Baroda

Share your email for latest updates


Our partners