1 / 29

AJAX Behind the buzz word

Learn about AJAX, a set of technologies used together to create interactive web applications. Discover its benefits, drawbacks, browser support, and real-world examples.

hware
Download Presentation

AJAX Behind the buzz word

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. AJAX Behind the buzz word Forum .NET ● January 23, 2006 Random Logic l Forum .NET l 2006

  2. What is Ajax? - Not a technology but a methodology. - A set of technologies being used together in a particular way. Random Logic l Forum .NET l 2006

  3. AJAX Which stands for • Asynchronous JavaScript and XML which is itself short for... • Asynchronous JavaScript • XHTML • DOM • CSS • XMLHTTPRequest Random Logic l Forum .NET l 2006

  4. AJAX: From another view • standards-based presentation using XHTML and CSS; • dynamic display and interaction using the Document Object Model; • data interchange and manipulation using XML and XSLT; • asynchronous data retrieval using XMLHttpRequest; • and JavaScript binding everything together. Random Logic l Forum .NET l 2006

  5. Is it new? Not really • Hidden frames • Good old JavaScript Random Logic l Forum .NET l 2006

  6. So where did it come from? Adaptive Path>> Jesse James Garrett • Q. Why did you feel the need to give this a name? • A. I needed something shorter than “Asynchronous JavaScript+CSS+DOM+XMLHttpRequest” to use when discussing this approach with clients. Random Logic l Forum .NET l 2006

  7. Traditional Web Application HTML GET CSSHTML HTML POST Client Server Database Random Logic l Forum .NET l 2006

  8. Traditional Web Application Random Logic l Forum .NET l 2006

  9. Breaking the stop start paradigm Random Logic l Forum .NET l 2006

  10. AJAX the new generation Random Logic l Forum .NET l 2006

  11. AJAX Web Application • Controller spans the network • Standards based rich internet applications HTML / XHTML CSSXSLDOM XMLHTTP XML Data Client Server Database Random Logic l Forum .NET l 2006

  12. Random Logic l Forum .NET l 2006

  13. Why is it popular? • Google helped popularize it in GMail • Increase Usability of Web Applications • Rich Internet Applications without Flash • Save Bandwidth • Download only data you need • Faster interfaces (sometimes) • Solves User Frustration Random Logic l Forum .NET l 2006

  14. Why is it bad? • Breaks back button support • URL's don't change as state changes • Cross Browser Issues can be a pain • Using Ajax for the sake of Ajax • Can't access domains other than the calling domain • May be disabled (for security reasons) or not available on some browsers • Debugging Random Logic l Forum .NET l 2006

  15. Browser support • Browsers that support Ajax • Apple Safari 1.2 and above • Konqueror • Microsoft Internet Explorer 4.0 and above • Mozilla Firefox 1.0 and above • Netscape 7.1 and above • Opera 7.6 and above Random Logic l Forum .NET l 2006

  16. AJAX in the real world Random Logic l Forum .NET l 2006

  17. Examples of AJAX • GMail • Google Maps • Google Suggest • NetVibes Random Logic l Forum .NET l 2006

  18. XMLHttpRequest • A JavaScript Class that lets you make asynchronous HTTP requests from JavaScript • Make an HTTP request from a JavaScript event • A call back JavaScript function is invoked at each state of the HTTP request and response • Native XMLHttpRequest support should be in IE7 Random Logic l Forum .NET l 2006

  19. XMLHttpRequest Properties • onreadystatechange - call back function for state changes • readyState - the current state of the HTTP call • responseText - the text result of the request • responseXML - DOM xml object from the request • status - HTTP status code of the response • statusText - HTTP status text Random Logic l Forum .NET l 2006

  20. Random Logic l Forum .NET l 2006

  21. A simple exampleXML file Random Logic l Forum .NET l 2006

  22. Ajax.NET – How it works • Add reference ajax.dll to your project • Modify your web.config to configure IHttpHandler for Ajax.NET requests • Write your methods in C#/VB.NET and add the attribute [AjaxMethod] • Call Class1.Method1(param1, param2, callback, context); from client-side JavaScript Random Logic l Forum .NET l 2006

  23. Demo AJAX.NET Random Logic l Forum .NET l 2006

  24. Ajax.NET – Key Benefits • Methods only get attribute, no need to implement interface or inherit from class[AjaxMethod]public int GetAge(string username){…} • Source-code doesn‘t change if you want to use the method in server-side codeDemoMethods dm = new DemoMethods();int age = dm.GetAge(“michael“); Random Logic l Forum .NET l 2006

  25. Ajax.NET – Key Benefits • Client-side JavaScript will get “real“ objects from Ajax.NET calls using JSON<script type=“text/javascript“>function test_callback(res) { alert(res.value.FirstName + ‘ ‘ + res.value.FamilyName); }</script> • DataSet, DataTable, DataRow, ArrayList, Array, DateTime, TimeSpan, … • Create your own IAjaxObjectConverters Random Logic l Forum .NET l 2006

  26. Ajax.NET – Key Benefits • Cache requests (CacheDurationTimeSpan) • Access SessionState objects using HttpContext.Current.Session[…] • Unicode support without use of XML parser • Use Ajax.NET to retreive “events“ instead of polling Random Logic l Forum .NET l 2006

  27. Conclusion • AJAX enable more interactive, more responsive, and smarter Web applications. • AJAX is not tied to a particular programming language. • Remember AJAX has its cons use it wisely. Random Logic l Forum .NET l 2006

  28. Questions? Random Logic l Forum .NET l 2006

  29. Thank You Random Logic l Forum .NET l 2006

More Related