AJAX <ul><li>Ajax (shorthand for asynchronous JavaScript + XML) is a group of interrelated web development techniques used...
HISTORY OF AJAX <ul><li>In the 1990s, web browsers and web sites were based on static pages and each user action required ...
WORKING PRINCIPLE OF AJAX
STEPS FOR THE WORKING OF AJAX <ul><li>In a simple web application, the interaction between the client and the server is go...
TECHNOLOGY USED IN AJAX <ul><li>Ajax as a combination of set of technologies.Use of Ajax is combination is of four things ...
SENDING METHODS AND THIER FUNCTIONS
USING THE POST AND GET METHOD <ul><li>GET AND POST methods are basically used as for sending the data from the form to the...
DIFFERENCE IN POST AND GET METHOD <ul><li>GET method: The GET method sends the encoded user information appended to the pa...
<ul><li>Sending a request to the server the functions commonly used is: </li></ul><ul><li>1: open((&quot;GET&quot;,&quot;u...
<ul><li>2: send(): Sends the http request to the server. Null or empty with get command, string otherwise.If all the files...
USE OF POST FUNCTIONS <ul><li>Use of post functions: </li></ul><ul><li>Usually GET method is used while creating an Ajax a...
AJAX REQUEST Ajax sends a request to the server with following some method, the methods are “open()” and “send()”, the ope...
<ul><li>The format of the open and send method are: </li></ul><ul><li>xmlhttp.open(&quot;GET&quot;,&quot;validate.php&quot...
<ul><li>Example: </li></ul><ul><li>function ajaxReq() { </li></ul><ul><li>return (isset($_SERVER['HTTP_X_REQUESTED_WITH'])...
AJAX WORKING WITH BROWSER <ul><li>Ajax unfortunately doesn’t have same code for all browser, it has little bit different f...
DRAWBACKS <ul><li>*Owing to their dynamic nature, Ajax interfaces are often harder to develop when compared to static page...
Upcoming SlideShare
Loading in...5
×

AJAX

897

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
897
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
39
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "AJAX"

  1. 1. AJAX <ul><li>Ajax (shorthand for asynchronous JavaScript + XML) is a group of interrelated web development techniques used on the client-side to create interactive web applications. With Ajax, web applications can retrieve data from the server asynchronously in the background without interfering with the display and behavior of the existing page.The use of Ajax techniques has led to an increase in interactive or dynamic interfaces on web pages. </li></ul><ul><li>Ajax stands “A”: Asynchronous,”JA”: JavaScript”X”: XML. It is a group of (JavaScript and Xml) interrelated web development techniques used on the client side to create interactive web application. Any server side technology that supports JavaScript also supports Ajax. </li></ul><ul><li>• Foundation purpose of Ajax not to giving the output, but is to provide a simple and standard means/output for a web page to communicate with the server without doing a complete page refresh. </li></ul><ul><li>• Ajax programming is introduced in 2005 by Google. </li></ul><ul><li>• Basically it is not a new programming language, but is a way to use existing standards to make the things better, faster and more user-friendly. </li></ul>
  2. 2. HISTORY OF AJAX <ul><li>In the 1990s, web browsers and web sites were based on static pages and each user action required that the page be re-loaded from the server (or a new page loaded). This could slow down user interaction considerably. </li></ul><ul><li>Asynchronous loading of content first became practical when Java applets were introduced in the first version of the Java language in 1995. These allow compiled client-side code to load data asynchronously from the web server after a web page is loaded.[3] In 1996, Internet Explorer introduced the IFrame element to HTML, which also enabled asynchronous loading.[4] In 1999, Microsoft created the XMLHTTP ActiveX control in Internet Explorer 5, which was later adopted by Mozilla, Safari, Opera and other browsers as the native XMLHttpRequest object.[4][5] Microsoft has adopted the native XMLHttpRequest model as of Internet Explorer 7, though the ActiveX version is still supported. The utility of background HTTP requests to the server and asynchronous web technologies remained fairly obscure until it started appearing in full scale online applications such as Outlook Web Access,(2000)[6] Oddpost (2002), and later, notably Google made a wide deployment of Ajax with Gmail (2004) and Google Maps (2005).[7] </li></ul><ul><li>The term &quot;Ajax&quot; was coined in 2005 by Jesse James Garrett.[1] However, a patent application covering this type of user interface was filed on September 3, 2003, thus predating the term itself by two years. This application resulted in US Patent #7,523,401 being issued to Greg Aldridge of Kokomo, IN.[8] On April 5, 2006 the World Wide Web Consortium (W3C) released the first draft specification for the object in an attempt to create an official web standard.[7] </li></ul>
  3. 3. WORKING PRINCIPLE OF AJAX
  4. 4. STEPS FOR THE WORKING OF AJAX <ul><li>In a simple web application, the interaction between the client and the server is going like this: </li></ul><ul><li>1. User first accesses a Web application (for example: filling a form, i.e. request the query to the server through a text field or etc.) </li></ul><ul><li>2. Server processes the request coming from the browser (client side) and sends data to the browser while the client waits. I.e., As the request is being send to the server the server process the request and sent the response to the same page and the response is received at that page without being refreshing the page, or you can say that the only the desired part is refreshes. </li></ul>
  5. 5. TECHNOLOGY USED IN AJAX <ul><li>Ajax as a combination of set of technologies.Use of Ajax is combination is of four things - </li></ul><ul><li>1: HTML/Xhtml, 2: JAVASCRIPT, 3: XML, 4: CSS. </li></ul><ul><li>2. JAVASCRIPT(ECMA Script) used for the local processing and DOM (Document Object model) data access inside the page or access elements of XML file read on the server. </li></ul><ul><li>3. Asynchronous data retrieval with XMLHttpRequest object. </li></ul>
  6. 6. SENDING METHODS AND THIER FUNCTIONS
  7. 7. USING THE POST AND GET METHOD <ul><li>GET AND POST methods are basically used as for sending the data from the form to the data processing page(server), both are used in form data handling process, but they have some difference for using. </li></ul>
  8. 8. DIFFERENCE IN POST AND GET METHOD <ul><li>GET method: The GET method sends the encoded user information appended to the page request. The page and the encoded information are separated by the “?”. And method is restricted to send unto 1024 characters only. It will display in the address bar with the data sending in the form. </li></ul><ul><li>The Get is one the simplest Http method. Its main job is to ask the server for the resource. If the resource is available than it will given back to the user on your browser. </li></ul><ul><li>POST method: While in the post method the data send to the server does not any restriction, it does not display in the url, ie the request made by it is goes invisible, so it is a safe method for sending your passwords or private things. </li></ul><ul><li>The method is used in the ajax in open and send methods so we define them first.This method is most powerful request. </li></ul>
  9. 9. <ul><li>Sending a request to the server the functions commonly used is: </li></ul><ul><li>1: open((&quot;GET&quot;,&quot;url”,true): </li></ul><ul><li>The open method start the connection, in read or write mode, to receive data from the server or send it. It takes three arguments. </li></ul><ul><li>First paramenter : Defines the type of the method during a request is to be send(POST or GET). </li></ul><ul><li>Second parameter: Is for url of the serverside script(PHP script). </li></ul><ul><li>The third parameter :(true) says we're going to make this request asynchronously which means we're going to call the url and then go off and do other stuff without waiting for a response from the server. When the data gets back from the server the browser will call our callback function for us and we can process the data then. </li></ul>
  10. 10. <ul><li>2: send(): Sends the http request to the server. Null or empty with get command, string otherwise.If all the files are in the same folder then: </li></ul><ul><li>xmlhttp.open(&quot;GET&quot;,&quot;validate.php&quot;,true); </li></ul><ul><li>xmlhttp.send(null); </li></ul>
  11. 11. USE OF POST FUNCTIONS <ul><li>Use of post functions: </li></ul><ul><li>Usually GET method is used while creating an Ajax application. But it will not be means that the post method is never used in ajax, there are several occasions when post is necessary for creating a Ajax application.Instead, post request are much secure than GET request. </li></ul><ul><li>USE OF GET Statement </li></ul><ul><li>var url = &quot;get_method.php&quot;; </li></ul><ul><li>var params = &quot;kam=al&name=eBIZ&quot;; </li></ul><ul><li>http.open(&quot;GET&quot;, url+&quot;?&quot;+params, true); </li></ul><ul><li>http.onreadystatechange = function() {//It Calls a function when the state changes. </li></ul><ul><li>if(http.readyState == 4 && http.status == 200) { </li></ul><ul><li>alert(http.responseText); </li></ul><ul><li>} </li></ul><ul><li>} </li></ul><ul><li>http.send(null); </li></ul><ul><li>} </li></ul>
  12. 12. AJAX REQUEST Ajax sends a request to the server with following some method, the methods are “open()” and “send()”, the open method uses three augments, first is method type, second is defined the url of the server side script and the third one is specifies that the request should be handled asynchronously and the send method is sends the request off to the server.
  13. 13. <ul><li>The format of the open and send method are: </li></ul><ul><li>xmlhttp.open(&quot;GET&quot;,&quot;validate.php&quot;,true); </li></ul><ul><li>xmlhttp.send(null); </li></ul><ul><li>It Initiates and process an ajax request. It simply allows to interact with the server. </li></ul><ul><li>Use: </li></ul><ul><li>new Ajax.Request(url[, options]) </li></ul><ul><li>Actually this object is made for wrapping an instance of XMLHttpRequest and provides the facilities for setting function that are called before a request is made and after a request returns. This is made for handling the server response.Point to be remember that whenever an Ajax request is sent to the server, a special header named “X-Requested-With” with a value of XMLHttpRequest is attached to the request. </li></ul>
  14. 14. <ul><li>Example: </li></ul><ul><li>function ajaxReq() { </li></ul><ul><li>return (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest')); </li></ul><ul><li>} </li></ul>
  15. 15. AJAX WORKING WITH BROWSER <ul><li>Ajax unfortunately doesn’t have same code for all browser, it has little bit different for all the browser. The keystone of Ajax is XMLHttpRequest object. And it will be very necessary for you to know about the XMLHttpObject, how it makes all browser compactible with the code. </li></ul>
  16. 16. DRAWBACKS <ul><li>*Owing to their dynamic nature, Ajax interfaces are often harder to develop when compared to static pages. </li></ul><ul><li>* Pages dynamically created using successive Ajax requests do not automatically register themselves with the browser's history engine, so clicking the browser's &quot;back&quot; button may not return the user to an earlier state of the Ajax-enabled page, but may instead return them to the last full page visited before it. Workarounds include the use of invisible IFrames to trigger changes in the browser's history and changing the URL fragment identifier (the portion of a URL after the '#') when Ajax is run and monitoring it for changes. </li></ul><ul><li>* Dynamic web page updates also make it difficult for a user to bookmark a particular state of the application. Solutions to this problem exist, many of which use the URL fragment identifier (the portion of a URL after the '#') to keep track of, and allow users to return to, the application in a given state. </li></ul>
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×