learn ajax at amc square learning

9
Learn AJAX at AMC Square Learning

Upload: amc-square

Post on 07-Nov-2015

3 views

Category:

Documents


0 download

DESCRIPTION

AMC Squarelearning Bangalore is the best training institute for a career development. it had students from various parts of the country and even few were from West African countries.

TRANSCRIPT

  • Learn AJAX at AMC Square Learning

  • What is AJAX ?"Asynchronous JavaScript and XML"New name for an old technique:JavaScript + DHTML + XMLHttpRequestIn use since at least 1997I've used it since 2000Finally someone gave it a nameAlready enabled in your Web server and browserUse JavaScript asynchronously behind the scenes to load additional data (typically XML) without discarding and reloading the entire Web page.

  • Why to use AJAX ?Used for developing fast and dynamic websiteHelps to process performing data in the client side (JavaScript) with data taken from the server.Selectively modify a part of the page displayed by the browser without resubmitting.

  • Elements of AJAXHTML and CSS JavaScriptThe XMLHttpRequest class

  • Working of AJAX :Use a programming model with display and eventsUse XMLHttpRequest to get data on the server using two methods :open() and send()Open() : for creating connectionSend() : for sending request to the serverData processed by the server will be found in the attributes of XMLHttpRequest object.responseXML : for an XML fileresponseText : for plain textreadyState attribute of XMLHttpRequest is used for finding the availability of data5 states 0:not initialized, 1:connection established, 2:request received, 3: ans in progress , 4: finished

  • Implementing AJAXTo implement AJAX we need to answer three questions:What triggers the AJAX request?Usually a JavaScript event (onblur, onclick, etc.)What is the server process that handles the AJAX request and issues the response?Some kind of URL (use a Service Locator)What processes the response from the server(what is the callback method)?A JavaScript function that gets the response and manipulates the DOM, based on the text returned.

  • Security IssuesCan only hit domain the Web page came fromCannot access a 3rd party Web ServiceHowever:You can wrap those requests through your own serverUser can allow access to specific sites via browser security settingsIFRAME can access any site (instead of XMLHttpRequest)

  • Drawbacks of AJAXAjax wont work if JavaScript is not activatedBack button may be deactivatedSince data to display are displaying dynamically ,they are not part of the page. (keywords inside are not used by search engine)

  • Thank you