Ajax is not a single programming language and does not owe its invention to any individual or group. Ajax came about as a result of experiments by a number of different organizations, including Microsoft and Google. “Ajax: A New Approach to Web Applications”, an article by user-experience designer Jesse James Garrett, was influential in popularizing Ajax among web developers (all would-be Ajax developers are advised to read the original article, which can be found here). By 2006, the W3C attempted to create a web standard for Ajax with the release of the first draft specification for XHMLHttpRequest.
1. Explain Some Common Security Issues with Ajax.
An Ajax call acts as a conduit between the user and the server. All data collected by the Ajax call is transmitted to the server in plain text. This data may often contain sensitive information such as usernames, passwords, email addresses, etc. Since the data is sent in plain text, it is extremely vulnerable to hacker attacks.
Hackers can also use Ajax to insert malicious scripts in a webpage and monitor user activity. Further, Ajax fundamentally encourages developers to create more than one server-side pages. The larger the number of server-side pages, the more entry points hackers have to gain access to secure data.
2. Which Side Controls an Ajax Interaction – Server Side or Client Side?
Establishing control in any Ajax interaction is not a black and white process. Control can either be server-side, or use a mix of server-side and client-side controllers.
Learn how to become a complete web developer with this course from Udemy!
3. If You Had to Create Your Own Ajax Functionality from Scratch, What Technologies Would You Use?
This question is essentially asking us about the technologies that make up Ajax. Knowing what we know about Ajax, if we had to build Ajax functionality from scratch, we would have to learn the following technologies/languages:
- DOM: DOM or Document Object Model, is a cross-platform convention or API used for interacting with an object in a XML or HTML page.
- CSS: CSS or Cascading Style Sheets is a web standard used for styling and presenting data on a web page.
Besides these technologies, a strong understanding of how HTTP requests work, especially XMLHttpRequests, is also crucial for building your own Ajax functionality. You can learn how to use Ajax with this course on building a fast loading, SEO friendly Ajax website.
4. What Are Some Disadvantages of Using Ajax on a Web Page?
- Security: As mentioned above, Ajax transmits data from the client to the server-side in plain text. This makes Ajax applications vulnerable to hackers.
- Development Time: Since Ajax basically involves learning and using a number of different technologies, development time for an Ajax application can be much longer than for an app written in a comparable language.
- User-Experience: In an Ajax application, data is loaded asynchronously from the server to the client. Since there is no page-refresh, there is no browsing history. This means that the back/forward buttons in a browser are rendered useless, which can affect user-experience. It is possible to mitigate this problem using the Really Simple History library.
5. List Some Common Ajax Frameworks.
- Prototype: The Prototype toolkit emphasizes visuals effects, animations and interactions. It’s a lightweight toolkit that is great for rapid iteration. It also supports Rico and Script.aculo.us which add additional visual effects capabilities.
- Spry: The Spry framework was developed by Adobe and is distributed under the BSD license. It consists of animation and visual effects components (Spry Effects), a data binding component (Spry Data), and a framework to crate widgets (Spry Widgets).
What Ajax interview questions were you asked in your interview? Share in the comments section below!