Web Programming Language

Slides:



Advertisements
Similar presentations
CSCI 3100 Tutorial 6 Web Development Tools 1 Cuiyun GAO 1.
Advertisements

JQUERY/AJAX ALIREZA KHATAMIAN DELARAM YAZDANSEPAS.
Lecture 3 – Data Storage with XML+AJAX and MySQL+socket.io
PhpXperts What is jQuery Javascript Library Fast and concise Simplifies the interaction between HTML and JavaScript.
Lecture 12 – AJAX SFDV3011 – Advanced Web Development Reference: 1.
AJAX and Java ISYS 350. AJAX Asynchronous JavaScript and XML: – Related technologies: JavaScript, Document Object Model, XML, server-side script such.
10 Adding Interactivity to a Web Site Section 10.1 Define scripting Summarize interactivity design guidelines Identify scripting languages Compare common.
JavaScript is a client-side scripting language. Programs run in the web browser on the client's computer. (PHP, in contrast, is a server-side scripting.
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.
Fall 2006 Florida Atlantic University Department of Computer Science & Engineering COP 4814 – Web Services Dr. Roy Levow Part 2 – Ajax Fundamentals.
Asynchronous Javascript And XML AJAX : an introduction UFCEUS-20-2 : Web Programming.
JQuery JavaScript is a powerful language but it is not always easy to work with. jQuery is a JavaScript library that helps with: – HTML document traversal.
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
AJAX Asynchronous JavaScript and XML 1. AJAX Outline What is AJAX? Benefits Real world examples How it works 2.
CHAPTER 13 COMMUNICATING WITH AJAX. LEARNING OBJECTIVES AJAX, which stands for Asynchronous JavaScript and XMLprovides a way for a browser to send and.
CHAPTER 8 AJAX & JSON WHAT IS AJAX? Ajax lets you…
Mr. Justin “JET” Turner CSCI 3000 – Fall 2015 CRN Section A – TR 9:30-10:45 CRN – Section B – TR 5:30-6:45.
AJAX – Asynchronous JavaScript And XML By Kranthi Kiran Nuthi CIS 764 Kansas State University.
DYNAMIC WEB PAGES Dr Mohd Soperi Mohd Zahid Semester /16.
CS 174: Web Programming October 28 Class Meeting Department of Computer Science San Jose State University Fall 2015 Instructor: Ron Mak
NCCUCS 軟體工程概論 Lecture 5: Ajax, Mashups April 29, 2014.
JQuery, JSON, AJAX. AJAX: Async JavaScript & XML In traditional Web coding, to get information from a database or a file on the server –make an HTML form.
JQuery.
Section 10.1 Define scripting
Servlets What is a Servlet?
Web Programming Language
Web Technologies Computing Science Thompson Rivers University
JavaScript and Ajax (Ajax Tutorial)
4.01 Cascading Style Sheets
Understanding XMLHttpRequest
Not a Language but a series of techniques
AJAX AJAX = Asynchronous JavaScript and XML.
AJAX.
AJAX and jQuery AJAX AJAX Concepts, XMLHttpRequest, jQuery AJAX: $.ajax(), $.get(), $.post() jQuery AJAX XMLHttpRequest SoftUni Team Technical Trainers.
AJAX and REST.
Callback Function function passed as a parameter to another function
Introduction to Web programming
AJAX.
Fundamentals, DOM, Events, AJAX, UI
AJAX.
Section 10.1 YOU WILL LEARN TO… Define scripting
CMPE 280 Web UI Design and Development March 1 Class Meeting
Web System & Technology
CSE 154 Lecture 22: AJAX.
JQuery UI Plug-ins, Object Models & the Window Object
Ajax and JSON (jQuery part 2)
Using jQuery Dr. Charles Severance
ISC440: Web Programming 2 AJAX
JavaScript & jQuery AJAX.
Teaching slides Chapter 6.
MIS JavaScript and API Workshop (Part 3)
Javascript and JQuery SRM DSC.
E-commerce Applications Development
CMPE 280 Web UI Design and Development February 28 Class Meeting
RESTful Web Services.
Web-Applications & AJAX
DR. JOHN ABRAHAM PROFESSOR UTPA
Web Technology Even Sem 2015
Web Technologies Computing Science Thompson Rivers University
Introduction to AJAX and JSON
Ajax and JSON Jeremy Shafer Department of MIS Fox School of Business
4.01 Cascading Style Sheets
Ajax and JSON Jeremy Shafer Department of MIS Fox School of Business
Creating dynamic/interactive web pages
What is AJAX? AJAX is a developer's dream, because you can:
Introduction to Web programming
AJAX By Prof. B.A.Khivsara
Software Engineering for Internet Applications
Presentation transcript:

Web Programming Language Chapter 11

Asynchronous JavaScript and Jquery UI Introducing AJAX JQuery and AJAX JQuery UI

AJAX Asynchronous JavaScript and XML used for making asynchronous web applications, which means that different parts of the page can be loaded at different times

Looking back in History Early websites loaded a new HTML file when a page was requested But why not just update part of the page Heard of Frames? Frames were used to break a page down into sections, and each frame could load a different HTML file. But, search engines found it difficult to index pages. Different devices responded differently to frames. The Back button didn’t always work as expected. There is a better way!

AJAX Allows the browser to communicate with the server, by letting JavaScript use the XMLHttpRequest object to request data from the server. When an event occurs, JavaScript can create an instance of the XMLHttpRequest object, send it to the server, which sends a response in XML, or more commonly now JSON.

Basic AJAX Call

XMLHttpRequest Object Comes with the browser (mostly) IE 7+

Classic AJAX <html> <body> <p id="demo" onclick="UpdateContent()">Original Page Content.</p> <script> function UpdateContent() { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { document.getElementById("demo").innerHTML = this.responseText; } }; xhttp.open("GET", "newdata.txt", true); xhttp.send(); } </script> </body> </html>

ReadyState? Request not initialized 1 Server connection established 2 Request not initialized 1 Server connection established 2 Request received 3 Processing request 4 Request finished and response is ready

JQuery and AJAX JQuery offers a few methods that makes AJAX simple! The load() method $(“#div1”).load(“data.txt”); This would load the contents of a text file into div1. $(“#div1”).load(“data.htm #news”); This would load a section of an html file into div1. Any file could be loaded, including a PHP file.

$.get() method The get() method uses a callback function to be executed after data is returned from the server using the GET method. $(“#p1”).click(function(){ $.get(“data.txt”, function(data, status){ console.log(data + “: status : “ + status ); }); });

$.post() method The post() method posts data to the server using the post method $(“#p1”).click(function(){ $.post(“add_student.php”, { name: “Ken”, id: “1234” }, function(data, status){ console.log(data + “: status : “ + status ); }); }); The data here could then be added to a database using a script in add_student.php

$.ajax() method If $.post() and $.get() aren’t enough, Jquery also has a $.ajax() method. $(“#p1”).click(function(){ $.ajax({ url:“add_student.php”, data: { name: “Ken”, id: “1234” }, method: POST }) .done(function(html){ console.log(html); }); });

JQuery UI A set of tools to help improve the user interface. Download and include <link rel=”stylesheet” href=”jquery-ui.min.css”> <script src=”external/jquery/jquery.js”></script> <script src=”jquery-ui.min.js”></script>

JQuery UI Date Picker HTML5 includes a date input type:- <input type="date"> Chrome Edge

Consistency in Date Picking! <script> $( function() { $("#date").datepicker(); }); </script> Date: <input type="text" id="date">

JQuery UI Dialog Boxes <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <link rel="stylesheet" href="ui/jquery-ui.min.css"> <script src="https://code.jquery.com/jquery-1.12.4.js"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <script> $(document).ready(function() { $("#appointment").click(function() { $("#dialog").dialog(); }); }); </script> </head> <body> <div id="appointment">Click here for details</div> <div id="dialog" style="display:none"> <p>Web Programming Final Exam at 12:00pm</p> </div> </body> </html>

JQuery UI Draggables & Droppables <html> <head> <link rel="stylesheet" type="text/css" href="jquery-ui.css"> <script src="jquery.min.js"></script> <script type="text/javascript" src="jquery-ui.min.js"></script> <style type="text/css"> #draggable { width: 50px; height: 50px; background: black;} #droppable { position: absolute; left: 100px; top: 100px; width: 55px; height: 55px; background: gray;} </style> <script> $(document).ready(function() { $("#draggable").draggable(); $("#droppable").droppable({ drop: function() { alert('dropped'); } }); }); </script> </head> <body> <div id="droppable"></div> <div id="draggable"></div> </body> </html>

Key Points Asynchronous JavaScript allows the browser to get updates from the server and change parts of the page independently. An XMLHttpRequest object is used by the browser to send a request to the server. JQuery makes AJAX simpler using its load(), get() and post() methods. If those methods aren’t enough, the versatile ajax() method can be used. The JQuery UI extension can be used to improve the user interface, it includes several features including a date picker, dialog boxes, draggables and droppables.