Using jQuery Dr. Charles Severance

Slides:



Advertisements
Similar presentations
Introduction to PHP Dr. Charles Severance
Advertisements

Week 12: JQuery Write less, do more.. JQuery Basics Lightweight JavaScript Library – Emphasizes interaction between JavaScript and HTML – Reduces technical.
Cloud Computing Lecture #7 Introduction to Ajax Jimmy Lin The iSchool University of Maryland Wednesday, October 15, 2008 This work is licensed under a.
Multiple Tiers in Action
Getting PHP Hosting Dr. Charles Severance. What We Need We want to be able to put up our application on the web so anyone can access our URL (and so we.
JQuery. What is jQuery? jQuery is a fast, small, and feature-rich JavaScript library that simplifies HTML document traversing and manipulation event handling.
Philly.NET Hands-On jQuery + Plug-ins Bill Wolff, Rob Keiser.
Forms and PHP Dr. Charles Severance
It’s World Wide! I NTRODUCTION TO T HE WEB 1 Photo courtesy:
Cookies, Sessions, and Authentication Dr. Charles Severance
PHP Arrays Dr. Charles Severance
Introduction to Dynamic Web Content Dr. Charles Severance
Using jQuery / APIs / JSON Dr. Charles Severance
JavaScript Dr. Charles Severance
Web Technologies Lecture 8 JQuery. “A fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax.
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.
Document Object Model Nasrullah. DOM When a page is loaded,browser creates a Document Object Model of the Page.
Forms and PHP Dr. Charles Severance
PHP Arrays Dr. Charles Severance
Introduction to JavaScript MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/2/2016.
Javascript AJAX HTML WEB SERVER Asynchronous. Javascript HTML events DOM – document object model browser internal view of html page compute.
Using jQuery Dr. Charles Severance
Using Handlebars Dr. Charles Severance
HTML Elements: Forms and Controls Chapter 9 B. Ramamurthy.
COM621: Advanced Interactive Web Development Lecture 6 – JavaScript (cont.)
Introduction to Dynamic Web Content Dr. Charles Severance
Java Script and the DOM DOM stands for: –The Document Object Model When a browser reads a web page, it converts it’s contents from HTML into a hierarchical.
Dr. Charles Severance Using Handlebars Dr. Charles Severance
C.R.U.D. Charles Severance
Form Processing in PHP Dr. Charles Severance
Introduction to Dynamic Web Content
PHP Arrays Dr. Charles Severance
Our Technologies Dr. Charles Severance
HTML Charles Severance
JavaScript Dr. Charles Severance
PHP Functions / Modularity
Transactions Dr. Charles Severance
Cascading Style Sheets
Tek Raj Chhetri Code for Humans not for machine.
Getting PHP Hosting Dr. Charles Severance
Using JSON Dr. Charles Severance
Redirect, Routing, and Authentication
Introduction to PHP Dr. Charles Severance
Loops and Iteration Chapter 5 Python for Everybody
Introduction to PHP Dr. Charles Severance
HTTP Parameters and Arrays
Functions Chapter 4 Python for Everybody
Introduction to Web programming
PHP Arrays Dr. Charles Severance
Object Oriented Programming in JavaScript
Expressions and Control Flow in PHP
Tuples Chapter 10 Python for Everybody
PHP Namespaces (in progress)
Web Browser server client 3-Tier Architecture Apache web server PHP
Introduction to Dynamic Web Content
Basic HTML and Embed Codes
Web Programming Language
..
Secure Web Programming
MIS JavaScript and API Workshop (Part 2)
Getting started with jQuery
E-commerce Applications Development
Charles Severance Single Table SQL.
An introduction to jQuery
Introduction to Dynamic Web Content
An introduction to jQuery
HTML Tags and Structure
Data Modelling Many to Many
Introduction to Web programming
Model View Controller (MVC)
Presentation transcript:

Using jQuery Dr. Charles Severance www.wa4e.com http://www.wa4e.com/code/jquery-01.zip

Time DOM Apache MySql PHP PDO http://www.wa4e.com/code/rrc/ Browser Web Server Database Server DOM Send Request Apache MySql Parse Response PHP ind.php PDO JavaScript JQuery http://www.wa4e.com/code/rrc/

John Resig Started jQuery in 2005 to make his web development projects easier - Elegant way to select DOM elements - Clean way to register events Released in 2006 Works at Khan Academy as the “Dean of Computer Science”

jQuery Documentation The web is a wonderful source of jQuery documentation. http://docs.jquery.com/Main_Page http://api.jquery.com/ http://jqueryui.com/demos/ This lecture will only cover the basic elements of low-level JQuery.

jquery-01/hello.php <html> <head> </head> <body> <p>Here is some awesome page content</p> <script type="text/javascript" src="jquery.min.js"> </script> <script type="text/javascript"> $(document).ready(function(){ alert("Hello jQuery World!"); window.console && console.log('Hello jQuery..'); }); </body> jquery-01/hello.php

jquery-01/resize.php http://api.jquery.com/resize/ <html> <head> </head> <body> <script type="text/javascript" src="jquery.min.js"> </script> <script type="text/javascript"> $(window).resize(function() { console.log('.resize() called. width='+ $(window).width()+' height='+$(window).height()); }); <p>Here is some awesome page content</p> </body> jquery-01/resize.php http://api.jquery.com/resize/

jquery-01/toggle.php <p id="para">Where is the spinner? <img id="spinner" src="spinner.gif" height="25" style="vertical-align: middle; display:none;"> </p> <a href="#" onclick="$('#spinner').toggle(); return false;">Toggle</a> <a href="#" onclick="$('#para').css('background-color', 'red'); return false;">Red</a> <a href="#" onclick="$('#para').css('background-color', 'green'); return false;">Green</a>

jquery-01/autoecho.php jquery-01/autopost.php if ( ! isset($_POST['val']) ) return; sleep(5); echo('You sent: '.$_POST['val']); jquery-01/autoecho.php jquery-01/autopost.php <form id="target"> <input type="text" name="one" value="Hello there" style="vertical-align: middle;"/> <img id="spinner" src="spinner.gif" height="25" style="vertical-align: middle; display:none;"> </form> <div id="result"></div> ...

jquery-01/autopost.php <script type="text/javascript"> $('#target').change(function(event) { $('#spinner').show(); var form = $('#target'); var txt = form.find('input[name="one"]').val(); window.console && console.log('Sending POST'); $.post( 'autoecho.php', { 'val': txt }, function( data ) { window.console && console.log(data); $('#result').empty().append(data); $('#spinner').hide(); } ).error( function() { $('#target').css('background-color', 'red'); alert("Dang!"); }); }); </script> jquery-01/autopost.php

Time DOM Apache MySql PHP PDO http://www.wa4e.com/code/rrc/ Browser Web Server Database Server DOM Send Request Apache MySql Parse Response PHP ind.php PDO JavaScript JQuery http://www.wa4e.com/code/rrc/

Summary This focused on the mechanics of low-level JQuery. - Initialization setup - Event handling - DOM selection - DOM manipulation - Handling form data Next we will look at how use JSON to read data from the server.

Acknowledgements / Contributions These slides are Copyright 2010- Charles R. Severance (www.dr-chuck.com) as part of www.wa4e.com and made available under a Creative Commons Attribution 4.0 License. Please maintain this last slide in all copies of the document to comply with the attribution requirements of the license. If you make a change, feel free to add your name and organization to the list of contributors on this page as you republish the materials. Initial Development: Charles Severance, University of Michigan School of Information Insert new Contributors and Translators here including names and dates Continue new Contributors and Translators here Note from Chuck. Please retain and maintain this page as you remix and republish these materials. Please add any of your own improvements or contributions.

Additional Source Information Image of John Resig Copyright Charles R. Severance and licensed as CC-BY