80 likes | 232 Views
AJAX. AJAX?. AJAX – Asynchronous Javascript and XML It is a technique involving JS/XML Communication with a server HTTP in background Client side logic that makes a web app experience more like a desktop app Typically by manipulating the Document Object Model (DOM). Fundamentals.
E N D
AJAX? AJAX – Asynchronous Javascript and XML • It is a technique involving JS/XML • Communication with a server HTTP in background • Client side logic that makes a web app experience more like a desktop app • Typically by manipulating the Document Object Model (DOM)
Fundamentals • Asynchronous - ? • Non-blocking request. Send request and continue doing what you do. Handle response whenever it comes • Typically ideal when request handled offsite (and you aren’t doing the work
Javascript C/Java like language No longer tied to Java, just in name Weakly typed – everything is just a var Modularity is weak … wat?
Example var map;function initialize(){varmapOptions={ zoom:8, center:newgoogle.maps.LatLng(-34.397,150.644),mapTypeId:google.maps.MapTypeId.ROADMAP}; map =newgoogle.maps.Map(document.getElementById('map-canvas'),mapOptions);}google.maps.event.addDomListener(window,'load', initialize);
XML XML is the format of data exchange Request and Response is handled in XML which directly corresponds to DOM convention
HTTP • GET – Requests data from a specific resource • Can be cached • Can affect browser history (back button behavior) • Name/value pairs in the URL • POST – Submits data for processing in the HTTP body • Name/value pairs in the HTTP message itself • Heavier, typically slower, but cleaner (basically only advantage) • Good for binary data, large amounts of data