Software Engineering for Internet Applications

Slides:



Advertisements
Similar presentations
AJAX Presented by: Dickson Fu Dimas Ariawan Niels Andreassen Ryan Dial Jordan Nielson CMPUT 410 University of Alberta 2006.
Advertisements

Asynchronous HTTP request generation in JavaScript (AJAX)
Multiple Tiers in Action
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
Chapter 6 DOJO TOOLKITS. Objectives Discuss XML DOM Discuss JSON Discuss Ajax Response in XML, HTML, JSON, and Other Data Type.
Ajax (Asynchronous JavaScript and XML). AJAX  Enable asynchronous communication between a web client and a server.  A client is not blocked when an.
PHP and AJAX ISYS 475. AJAX Asynchronous JavaScript and XML: – JavaScript, Document Object Model, Cascade Style Sheet, XML, server-side script such as.Net,
JavaScript & jQuery the missing manual Chapter 11
Internet and Web Application Development Revision.
JavaScript Teppo Räisänen LIIKE/OAMK HTML, CSS, JavaScript HTML defines the structure CSS defines the layout JavaScript is used for scripting It.
Ruth Betcher Ruth Christie
Server-side Scripting Powering the webs favourite services.
Ajax - Part II Communicating with the Server. Learning Objectives By the end of this lecture, you should be able to: – Describe the overview of steps.
AJAX and Java ISYS 350. AJAX Asynchronous JavaScript and XML: – Related technologies: JavaScript, Document Object Model, XML, server-side script such.
Multifarious Project Team Members Alberto Dominguez Nirmit Gang Jimmy Garcia Javier Handal.
06/10/2015AJAX 1. 2 Introduction All material from AJAX – what is it? Traditional web pages and operation Examples of AJAX use Creating.
Client side web programming Introduction Jaana Holvikivi, DSc. School of ICT.
Dynamic web content HTTP and HTML: Berners-Lee’s Basics.
AJAX محمد احمدی نیا 2 Of 27 What is AJAX?  AJAX = Asynchronous JavaScript and XML.  AJAX is not a new programming language, but.
AJAX Compiled from “AJAX Programming” [Sang Shin] (Asynchronous JavaScript and XML)
Asynchronous Javascript And XML AJAX : an introduction UFCEUS-20-2 : Web Programming.
School of Computing and Information Systems CS 371 Web Application Programming AJAX.
CISC 3140 (CIS 20.2) Design & Implementation of Software Application II Instructor : M. Meyer Address: Course Page:
Session 1 Chapter 1 - Introduction to Web Development ITI 133: HTML5 Desktop and Mobile Level I
SYST Web Technologies SYST Web Technologies AJAX.
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
 AJAX – Asynchronous JavaScript and XML  Ajax is used to develop fast dynamic web applications  Allows web pages to be updated asynchronously by transferring.
Module: Software Engineering of Web Applications Chapter 2: Technologies 1.
AJAX Asynchronous JavaScript and XML 1. AJAX Outline What is AJAX? Benefits Real world examples How it works 2.
Event Handling & AJAX IT210 Web Systems. Question How do we enable users to dynamically interact with a website? Answer: Use mouse and keyboard to trigger.
AJAX and REST. Slide 2 What is AJAX? It’s an acronym for Asynchronous JavaScript and XML Although requests need not be asynchronous It’s not really a.
JavaScript & Introduction to AJAX
AJAX AJAX Asynchronous JavaScript and XML --- MADHAVI
AJAX – Asynchronous JavaScript And XML By Kranthi Kiran Nuthi CIS 764 Kansas State University.
INNOV-2: Build a Better Web Interface Using AJAX Chris Morgan Pandora Software Systems
Web Technology (NCS-504) Prepared By Mr. Abhishek Kesharwani Assistant Professor,UCER Naini,Allahabad.
 AJAX technology  Rich User Experience  Characteristics  Real live examples  JavaScript and AJAX  Web application workflow model – synchronous vs.
COSC 2328 – Web Programming.  PHP is a server scripting language  It’s widely-used and free  It’s an alternative to Microsoft’s ASP and Ruby  PHP.
AJAX CS456 Fall Examples Where is AJAX used? Why do we care?
JQUERY AND AJAX
Ajax! Ajax Programming Ajax! Ajax Programming. Ajax! Ajax Programming Take a look at a typical desktop application (Spreadsheet app, etc.) The program.
JavaScript and Ajax Week 10 Web site:
Web Technologies Computing Science Thompson Rivers University
JavaScript and Ajax (Ajax Tutorial)
Introduction to Dynamic Web Programming
CSE 154 Lecture 11: AJAx.
Not a Language but a series of techniques
CS 371 Web Application Programming
AJAX and REST.
XMLHttp Object.
AJAX.
AJAX.
PHP / MySQL Introduction
Prepared for Md. Zakir Hossain Lecturer, CSE, DUET Prepared by Miton Chandra Datta
Database Driven Websites
CSE 154 Lecture 11: AJAx.
AJAX and JSP ISYS 350.
CSE 154 Lecture 22: AJAX.
HTML5 Level I Session I Chapter 1 - Introduction to Web Development
ISC440: Web Programming 2 AJAX
JavaScript & jQuery AJAX.
Exchange data interface
AJAX CS-422 Dick Steflik.
DR. JOHN ABRAHAM PROFESSOR UTPA
Web Technology Even Sem 2015
Web Technologies Computing Science Thompson Rivers University
Class 4: Building Interactive Web Pages
AJAX and JSP ISYS 350.
AJAX By Prof. B.A.Khivsara
Presentation transcript:

Software Engineering for Internet Applications AJAX ADF 11/20/2019

Preface - XML Extensible Markup Language Extensible create your own self-descriptive tags, or language, that suits your application. carries the data, does not present it store the data irrespective of how it will be presented. public standard <message> <text>Hello, world!</text> </message> 11/20/2019

Preface - XML <?xml version="1.0" encoding="UTF-8"?> <student-info> <!-- Students data --> <student1> <name>Budi</name> <major>Computer Science</major> <stident-ID>113130001</stident-ID> </student1> <student2> <name>Cita</name> <stident-ID>113130004</stident-ID> </student2> </student-info> 11/20/2019

AJAX Asynchronous JavaScript and XML. a new technique for creating better, faster, and more interactive web applications with the help of XML, HTML, CSS, and Java Script 11/20/2019

Conventional web applications Synchronous full page refresh Transmit information to and from the sever using synchronous requests. It means you fill out a form, hit submit, and get directed to a new page with new information from the server 11/20/2019

Using AJAX Asynchronous partial refresh When you hit submit, JavaScript will make a request to the server, interpret the results, and update the current screen. In the purest sense, the user would never know that anything was even transmitted to the server. 11/20/2019

AJAX and RIA AJAX is the most viable Rich Internet Application (RIA) technology so far. It is getting tremendous industry momentum and several tool kit and frameworks are emerging. But at the same time, AJAX has browser incompatibility and it is supported by JavaScript, which is hard to maintain and debug 11/20/2019

AJAX – Partial Refresh Web page UI Your AJAX code Web server Click (event) Action request Update DOM User see the action occurs Send request to server Server reply with data Update DOM User see the action result 11/20/2019

AJAX process / operations Event from client Create XMLHttpRequest Send asynchronous request to WebServer WebServer return XML document result XMLHttpRequest calls callback() function and processes the result Update HTML DOM 11/20/2019

AJAX process / operations Example : Load text from a file text and display it on web page Event from client will occur when the user click the button <body> <div id="myDoc"><h2>No document to display... </h2></div> <button type="button" onclick="loadXMLDoc()">Load Document</button> </body> 11/20/2019

AJAX process / operations Create js function to send XMLHttpRequest Send asynchronous request to WebServer var ajaxRequest; function loadXMLDoc(){ if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari ajaxRequest=new XMLHttpRequest(); } else { // code for IE6, IE5 ajaxRequest=new ActiveXObject("Microsoft.XMLHTTP"); } // Here processRequest() is the callback function. ajaxRequest.onreadystatechange=processRequest; ajaxRequest.open("GET", "some document.txt",true); ajaxRequest.send(); } 11/20/2019

AJAX process / operations WebServer returns XML document result XMLHttpRequest call callback() function, and Create js callback function to Update the HTML DOM function processRequest(){ if (ajaxRequest.readyState==4 && ajaxRequest.status==200){ document.getElementById("myDoc").innerHTML= ajaxRequest.responseText; } 11/20/2019

AJAX process / operations (complete script) 11/20/2019

AJAX process / operations (complete script) 11/20/2019

AJAX Database Supposed you already have a database with table property of: tb_Student ( ‘studentID’ varchar(11), 'name' varchar(50), 'sex' varchar(1), ‘score' int(11) ) Create a AJAX operation to access database Client Side HTML : ajax_result.html Server Side PHP : ajax_server.php 11/20/2019

AJAX Database – Client side Create form to search data <form name='myForm'> Minimum score : <input type='text' id='score' /> <br /> Gender : <select id='sex'> <option value="m">male</option> <option value="f">female</option> </select> <br /> <input type='button' onclick='ajaxFunction()' value='Query MySQL'/> </form> 11/20/2019

AJAX Database – Client side Create function script to send XMLHttpRequest function ajaxFunction(){ if (window.XMLHttpRequest) { ajaxRequest=new XMLHttpRequest(); }else { ajaxRequest=new ActiveXObject("Microsoft.XMLHTTP"); } // Create a function that will receive data // sent from the server and will update // div section in the same page. ajaxRequest.onreadystatechange = processQuery; // Now get the value from user and pass it to // server script. var score = document.getElementById('score').value; var sex = document.getElementById('sex').value; var queryString = "?score=" + score + "&sex=" + sex; ajaxRequest.open("GET", "ajax_server.php" + queryString, true); ajaxRequest.send(null); 11/20/2019

AJAX Database – Client side Create callback function Create div to display the data function processQuery(){ if(ajaxRequest.readyState == 4){ var ajaxDisplay = document.getElementById('ajaxDiv'); ajaxDisplay.innerHTML = ajaxRequest.responseText; } <div id='ajaxDiv'>Result Data</div> 11/20/2019

AJAX Database – Client side (complete script) 11/20/2019

AJAX Database – Client side (complete script) 11/20/2019

AJAX Database – Server side Connect to database $dbhost = "localhost"; $dbuser = "dbusername"; $dbpass = "dbpassword"; $dbname = "dbname"; //Connect to MySQL Server mysql_connect($dbhost, $dbuser, $dbpass); //Select Database mysql_select_db($dbname) or die(mysql_error()); 11/20/2019

AJAX Database – Server side Retrieve data Build and execute query // Retrieve data from Query String $sex = $_GET['sex']; $score = $_GET['score']; // Escape User Input to help prevent SQL Injection $sex = mysql_real_escape_string($sex); $score = mysql_real_escape_string($score); //build query $query = "SELECT * FROM ajax_example WHERE sex = '$sex'"; if(is_numeric($score)) $query .= " AND score >= $score"; //Execute query $qry_result = mysql_query($query) or die(mysql_error()); 11/20/2019

AJAX Database – Server side Build the result string (DOM string update) //Build Result String $display_string = "<table>"; $display_string .= "<tr><th>Student ID</th>"; $display_string .= "<th>Name</th>"; $display_string .= "<th>Sex</th>"; $display_string .= "<th>Score</th></tr>"; // Insert a new row in the table for each person returned while($row = mysql_fetch_array($qry_result)){ $display_string .= "<tr>"; $display_string .= "<td>$row[studentID]</td>"; $display_string .= "<td>$row[name]</td>"; $display_string .= "<td>$row[sex]</td>"; $display_string .= "<td>$row[score]</td>"; $display_string .= "</tr>"; } $display_string .= "</table>"; 11/20/2019

AJAX Database – Server side Display the result echo "Query: " . $query . "<br />"; echo $display_string; 11/20/2019

AJAX Database – Server side (complete script) 11/20/2019

AJAX Database – Server side (complete script) 11/20/2019

AJAX Database – Server side (complete script) 11/20/2019

Question?

11/20/2019