JQUERY/AJAX ALIREZA KHATAMIAN DELARAM YAZDANSEPAS.

Slides:



Advertisements
Similar presentations
JQuery A Javascript Library Hard things made eas(ier) Norman White.
Advertisements

The Web Warrior Guide to Web Design Technologies
CS428 Web Engineering Lecture 15 Introduction to Jquery.
CGI Programming: Part 1. What is CGI? CGI = Common Gateway Interface Provides a standardized way for web browsers to: –Call programs on a server. –Pass.
Inline, Internal, and External FIle
Philly.NET Hands-On jQuery + Plug-ins Bill Wolff, Rob Keiser.
Anatomy of an App HTML, CSS, jQuery, jQuery Mobile CIS 136 Building Mobile Apps 1.
Fundamentals, DOM, Events, AJAX, UI Doncho Minkov Telerik Corporation
JQuery CS 268. What is jQuery? From their web site:
M. Taimoor Khan Courtesy: Norman White.
User Interface Design using jQuery Mobile CIS 136 Building Mobile Apps 1.
_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications1.
Interactive Web Application with AJAX
Nguyen Ich Cuong.  Course duration: 45’  Purpose: Present Introduction to JQuery  Targeted attendees: NICorp Trainee  Tests/quiz: Yes - 10’
JavaScript & jQuery the missing manual Chapter 11
Server-side Scripting Powering the webs favourite services.
Event Handlers CS101 Introduction to Computing. Learning Goals Learn about event handlers Determine how events are useful in JavaScript Discover where.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
Interacting with a Web Page using JavaScript Mat Kelly GTAI Presentation January 10, 2014.
06/10/2015AJAX 1. 2 Introduction All material from AJAX – what is it? Traditional web pages and operation Examples of AJAX use Creating.
Jquery Nasrullah. Jquery jQuery is a JavaScript Library. jQuery greatly simplifies JavaScript programming. jQuery is easy to learn.
INTRODUCTION TO HTML5 Using jQuery with HTML5. Introducing jQuery  Although it is not a part of any W3C or WHATWG specification, jQuery performs an important.
1 © Netskills Quality Internet Training, University of Newcastle HTML Forms © Netskills, Quality Internet Training, University of Newcastle Netskills is.
Animation & Effects Using JQuery. What is jQuery? jQuery is a lightweight, JavaScript library. The purpose of jQuery is to make it much easier to use.
CHAPTER 5 jQuery อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
Asynchronous Javascript And XML AJAX : an introduction UFCEUS-20-2 : Web Programming.
JavaScript Library. What is jQuery jQuery is a lightweight JavaScript library. The purpose is to make it easier to use JavaScript code on your website.
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.
JavaScript Introduction.  JavaScript is a scripting language  A scripting language is a lightweight programming language  A JavaScript can be inserted.
Web Programming Language Week 9 Dr. Ken Cosh Introducing jQuery.
Creating Dynamic Webpages
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
JQuery and AJAX WEB Technologies : PHP Programming Language.
Intro to jQuery. What is jQuery? A JavaScript library Lightweight (about 31KB for the minified version) Simplifies HTML document traversing (DOM), event.
IS2802 Introduction to Multimedia Applications for Business Lecture 07: Introduction to jQuery Rob Gleasure
Web Programming JAvaScript Ajax Programming Web Programming /38.
CHAPTER 8 AJAX & JSON WHAT IS AJAX? Ajax lets you…
AJAX – Asynchronous JavaScript And XML By Kranthi Kiran Nuthi CIS 764 Kansas State University.
Introduction to JQuery COGS 187A – Fall JQuery jQuery is a JavaScript library, and allows us to manipulate HTML and CSS after the page has been.
KAPITA SELEKTA INFORMATIKA Lasmedi Afuan, ST.M.Cs.
AJAX CS456 Fall Examples Where is AJAX used? Why do we care?
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
JQuery Tutorial. What is jQuery jQuery is a JavaScript Library The purpose of jQuery is to make it much easier to use JavaScript on your website JavaScript.
JQuery form submission CIS 136 Building Mobile Apps 1.
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.
AJAX. Objectives Understand and apply AJAX Using AJAX in DOJO library.
JQuery.
What is jQuery?.
JavaScript and Ajax (Ajax Tutorial)
Tek Raj Chhetri Code for Humans not for machine.
Introduction to Web programming
JQuery Basics 소속 / 작성자 이 문서는 나눔글꼴로 작성되었습니다. 설치하기.
AJAX.
The Cliff Notes Version
JQuery with ASP.NET.
jQuery A Javascript Library Hard things made eas(ier)
HTML5 AJAX & JSON APIs
JavaScript & jQuery AJAX.
MIS JavaScript and API Workshop (Part 3)
Introduction to AJAX and JSON
Javascript and JQuery SRM DSC.
E-commerce Applications Development
Document Object Model.
Web Programming Language
Introduction to AJAX and JSON
Ajax and JSON Jeremy Shafer Department of MIS Fox School of Business
Ajax and JSON Jeremy Shafer Department of MIS Fox School of Business
SEEM4540 Tutorial 3 jQuery Wong Wai Chung.
JQuery.
Presentation transcript:

JQUERY/AJAX ALIREZA KHATAMIAN DELARAM YAZDANSEPAS

WHAT IS JQUERY ? Jquery is not a language, it is a well written JavaScript code. Fast and Concise Simplifies Interaction between HTML and JavaScript Syntax is same as JavaScript

JQUERY HELPS : Improve the performance of the application Develop most browser compatible web page Implement UI related critical functionality Fast Extensible Ajax functionality Small file size, Faster load time.

AJAX AJAX = Asynchronous JavaScript and XML. loading data in the background and display it on the webpage, without reloading the whole page. jQuery provides several methods for AJAX functionality. With the jQuery AJAX methods, you can request text, HTML, XML, or JSON from a remote server using both HTTP Get and HTTP Post - And you can load the external data directly into the selected HTML elements of your web page!

HOW TO START 1.Download Latest version (1.9.1) of Jquery Library at : 2.Create an empty JS file (for Jquery Functions and Animations) 3.Embed Jquery in your HTML code You simply use the HTML element and provide the element a value (URL or directory path) for its src="" attribute, and the external file you are linking to will be included in the web page

JQUERY SYNTAX Basic syntax is: $(selector).action() A $ sign to define/access jQuery A (selector) to "query (or find)" HTML elements A jQuery action() to be performed on the element(s) Examples: $(this).hide() - hides the current element. $("p").hide() - hides all elements. $(".test").hide() - hides all elements with class="test". $("#test").hide() - hides the element with id="test".

THE DOCUMENT READY EVENT You might have noticed that most jQuery methods, are inside a document ready event: $(document).ready(function(){ // jQuery methods go here... }); This is to prevent any jQuery code from running before the document is finished loading (is ready)

ADDING AND REMOVING AN HTML CLASS Another common task is adding or removing a class. First, add some style information into the of the document, like this: a.test { font-weight: bold; } 1$( "a" ).addClass( "test" ); 1$( "a" ).removeClass( "test" ); Next, call the addClass() to add a defined class:addClass() All elements are now bold. To remove an existing class, use removeClass():removeClass()

JQUERY EVENT METHODS What are Events? All the different visitor's actions that a web page can respond to are called events. An event represents the precise moment when something happens. Examples: moving a mouse over an element selecting a radio button clicking on an element Jquery event syntax: $("p").click(function(){ // action goes here!! });

AJAX LOAD() METHOD The load() method loads data from a server and puts the returned data into the selected element. Syntax: $(selector).load(URL,data,callback); o The required URL parameter specifies the URL you wish to load. o The optional data parameter specifies a set of querystring key/value pairs to send along with the request. o The optional callback parameter is the name of a function to be executed after the load() method is completed The following example loads the content of the file "test.txt" into a specific element: $("#div1").load("test.txt"); It is also possible to add a jQuery selector to the URL parameter. The following example loads the content of the element with id="p1", inside the file "test.txt", into a specific element: $("#div1").load("test.txt #p1");

The optional callback parameter specifies a callback function to run when the load() method is completed. The callback function can have different parameters: responseTxt - contains the resulting content if the call succeed statusTXT - contains the status of the call xhr - contains the XMLHttpRequest object The following example displays an alert box after the load() method completes. If the load() method has succeed, it displays "External content loaded successfully!", and if it fails it displays an error message: $("button").click(function(){ $("#div1").load("demo_test.txt",function(responseTxt,statusTxt,xhr){ if(statusTxt=="success") alert("External content loaded successfully!"); if(statusTxt=="error") alert("Error: "+xhr.status+": "+xhr.statusText); }); });

HTTP REQUEST: GET VS. POST Two commonly used methods for a request-response between a client and server GET - Requests data from a specified resource POST - Submits data to be processed to a specified resource $.get(URL,callback); The required URL parameter specifies the URL you wish to request. The optional callback parameter is the name of a function to be executed if the request succeeds. $.post(URL,data,callback); The required URL parameter specifies the URL you wish to request. The optional data parameter specifies some data to send along with the request. The optional callback parameter is the name of a function to be executed if the request succeeds.

EXAMPLE $("button").click(function(){ $.post("test_post.jsp", { name:“Bill Gates", city:“Seatle" }, function(data,status){ alert("Data: " + data + "\nStatus: " + status); }); }); The first parameter of $.post() is the URL we wish to request ("test_post.jsp"). Then we pass in some data to send along with the request (name and city). The JSP script in "test_post.jsp" reads the parameters, process them, and return a result. The third parameter is a callback function. The first callback parameter holds the content of the page requested, and the second callback parameter holds the status of the request.