Author: admin
-
Ajax Java Example
To create ajax example, you need to use any server-side language e.g. Servlet, JSP, PHP, ASP.Net etc. Here we are using JSP for generating the server-side code. In this example, we are simply printing the table of the given number. Steps to create ajax example with jsp You need to follow following steps: Load the org.json.jar file download this example, we have…
-
How AJAX works?
AJAX communicates with the server using XMLHttpRequest object. Let’s try to understand the flow of ajax or how ajax works by the image displayed below. As you can see in the above example, XMLHttpRequest object plays a important role.
-
Understanding XMLHttpRequest
An object of XMLHttpRequest is used for asynchronous communication between client and server. It performs following operations: Properties of XMLHttpRequest object The common properties of XMLHttpRequest object are as follows: Property Description onReadyStateChange It is called whenever readystate attribute changes. It must not be used with synchronous requests. readyState represents the state of the request.…
-
AJAX Technologies
As describe earlier, ajax is not a technology but group of inter-related technologies. AJAX technologies includes: HTML/XHTML and CSS These technologies are used for displaying content and style. It is mainly used for presentation. DOM It is used for dynamic display and interaction with data. XML or JSON For carrying data to and from server. JSON (Javascript…
-
Understanding Synchronous vs Asynchronous
Before understanding AJAX, let’s understand classic web application model and ajax web application model first. Synchronous (Classic Web-Application Model) A synchronous request blocks the client until operation completes i.e. browser is unresponsive. In such case, javascript engine of the browser is blocked. As you can see in the above image, full page is refreshed at…
-
Ajax Tutorial
AJAX tutorial covers concepts and examples of AJAX technology for beginners and professionals. AJAX is an acronym for Asynchronous JavaScript and XML. It is a group of inter-related technologies like JavaScript, DOM, XML, HTML/XHTML, CSS, XMLHttpRequest etc. AJAX allows you to send and receive data asynchronously without reloading the web page. So it is fast. AJAX allows you to send only important…
-
JavaScript Objects
What is an Object? JavaScript is an object-based language and in JavaScript almost everything is an object or acts like an object. So, to work with JavaScript effectively and efficiently we need to understand how objects work as well as how to create your own objects and use them. A JavaScript object is just a…
-
JavaScript Functions
What is Function? A function is a group of statements that perform specific tasks and can be kept and maintained separately form main program. Functions provide a way to create reusable code packages which are more portable and easier to debug. Here are some advantages of using functions: The following section will show you how…
-
JavaScript Loops
Different Types of Loops in JavaScript Loops are used to execute the same block of code again and again, as long as a certain condition is met. The basic idea behind a loop is to automate the repetitive tasks within a program to save the time and effort. JavaScript now supports five different types of…
-
JavaScript Sorting Arrays
Sorting an Array Sorting is a common task when working with arrays. It would be used, for instance, if you want to display the city or county names in alphabetical order. The JavaScript Array object has a built-in method sort() for sorting array elements in alphabetical order. The following example demonstrates how it works: Example Reversing an…