Event handling programming with ajax
Download
1 / 14

Event Handling Programming with AJAX - PowerPoint PPT Presentation


  • 119 Views
  • Uploaded on

Event Handling Programming with AJAX. By: Courtney Ball and Brian Robbins. Traditional AJAX. AJAX – Asynchronous JavaScript and XML. Traditional AJAX. Ajax is used to develop fast dynamic web applications

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Event Handling Programming with AJAX' - ivan


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Event handling programming with ajax

Event Handling Programming with AJAX

By: Courtney Ball and Brian Robbins


Traditional ajax
Traditional AJAX

  • AJAX – Asynchronous JavaScript and XML


Traditional ajax1
Traditional AJAX

  • Ajax is used to develop fast dynamic web applications

  • Allows web pages to be updated asynchronously by transferring data server side behind the scenes

  • Ajax is not a programming language itself but uses various web development techniques such as JavaScript, PHP, HTML, CSS and XML


Traditional ajax2
Traditional AJAX

  • Ajax uses HTTP requests to serve as the connection between the server and the user

  • Data is sent to the server, processed and immediately sent back to client side



Event driven ajax
Event Driven AJAX

  • Similar execution to traditional Ajax but uses an XMLHttpRequest object

  • Instead of using a continuous HTTP connection, after a request is sent, the request is terminated, so there are new requests after each response



Our project
Our Project

  • Using HTML, JavaScript and PHP, we are creating a simple web page that displays 5 options of colors in which the user can change the background to their desired color




Coding examples
Coding Examples

  • JavaScript for UI

    //Function that is called by the forms in javascript

    function blue() {

    document.bgColor = "blue";

    }

    //Form for calling a specific color

    <input type="button" value="BLUE" onClick= "blue()" />


Event handling programming with ajax

XMLHttpRequest object

  • function blue() {

  • varxhr;

  • //try and catch block for particular web browser

    • try {

    • xhr = new ActiveXObject('Msxml2.XMLHTTP');

    • }

  • catch (e) {

  • try {

  • xhr = new ActiveXObject('Microsoft.XMLHTTP');

  • }

  • catch (e2)

  • {

  • try {

  • xhr = new XMLHttpRequest(); //Instantiates new XmlHttpRequestObject

  • }

  • catch (e3) { xhr = false; }

  • }

  • }

  • xhr.onreadystatechange = function()

  • {

  • if(xhr.readyState == 4)

  • {

  • if(xhr.status == 200)

  • document.bgColor = "blue";

  • else

  • document.ajax.dyn="Error code " ;

  • }

  • };


Conclusion
Conclusion

  • Ajax is effective for fast dynamic web browsing, it is commonly used so that a user does not have to refresh the we browser to acquire new information


Conclusion1
Conclusion

  • Ajax is commonly seen in the popular social network facebook

  • It is also used in eCommerce websites such as eBay

  • Most recent it is seen in Youtube