SlideShare a Scribd company logo
1 of 33
A Rich Web Experience
With jQuery, Ajax and .NET


James Johnson
Founder and President, Inland Empire .NET User’s Group

Los Angeles .NET Developers Group
April 2nd, 2012
WHO I AM

Founder and President, Inland Empire .NET
 User’s Group
Four-time and current Microsoft MVP – CAD
Software developer by day
Serial netrepreneur by night
JAVASCRIPT

 Used to provide interactivity with a web page
 Enable programmatic access to a web page
 Dynamic
 Weakly typed
 Prototype-based
 Supports closures and higher order function
JAVASCRIPT

 Not to be confused with Java, it has a similar syntax
    {} and ;
 First released as LiveScript in September 1995
 Renamed to JavaScript in December 1995
 Easy to write functions, then copy and paste all over
 Quickly one of the most popular languages for web
  development
    But thought of as a kiddy language
 Advent of Ajax brought JavaScript attention by
  “professionals”
JAVASCRIPT

 Pros
   Dynamic
   Easy to develop with
   Easy to debug
   Similar syntax to “real” languages
 Cons
   Dynamic
   Easy to develop with
   Every browser seems to have it’s own JavaScript
    engine
   Difficult to have same behaviours across browsers
JAVASCRIPT LIBRARIES

 Pre-written JavaScript controls
 Easier development
 Many, many libraries
    Dojo, Echo, Ext, Google Web Toolkit, jQuery, MochiKit,
     MooTools, Prototype, qooxdoo, Rico, script.aculo.us,
     Spry, Yahoo! UI Library
JQUERY

 Released in January 2006 by John Resig
 Free, open source, dual-licensed under MIT and GNU
 Syntax is easier to navigate the DOM
 Handles events, creates animations, modify attributes
 Ajax grooviness baked in
 Used by over 39% of the top 10,000 websites
 Microsoft bundles with ASP.NET Ajax and ASP.NET
  MVC
    Full support from Microsoft
JQUERY BENEFITS

 Fast development
 Solid, standardized library
 Gracefully fails – no glaring errors or frozen pages
 Lots and lots and lots of examples
 Very easy to grok
 All the cool kids use it
 Intellisense with –vsdoc.js
JQUERY SYNTAX

 $(“some element”) or jQuery(“some element”)
 Can select by ID or className
    $(“#myElement”) gets the only ID=“myElement”
    $(“div.myElement”) gets all divs with
     class=“myElement”
 Easy to traverse
    $(“div.main ul li”) – all <li> within div class=“main”
    $(“div.main”).find(“li”) – same as above
    $(“div.main”).find(“li:odd”) – same as above but only
     ODD elements – zero-based
JQUERY SELECTORS

 Matching a set of document elements
 :checkbox, :eq(n), :even, :has(), :first, :last, :focus,
  :not()

$(“input:not(:checked)”);
$(“.myClass:even”);
$(“input:checkbox”);
$(“.my-class:has(p)”);
$(“input[type=„text‟]”);
JQUERY CHAINING

 Once an element is found, reference is kept
 Instead of
   $(“div.myElement”).hide();
   $(“div.myElement”).html(“hi”);
   $(“div.myElement”).addClass(“red”);
   $(“div.myElement”).fadeIn(“slow”);

 Chain the actions
  $(“div.myElement”).hide().html(“hi”)
   .addClass(“red”).fadeIn(“slow”);
JQUERY TRAVERSING

 .children() – all child elements, optional filter
 .each() – iterate through a collection of matched
  elements
 .find() – get descendants of element
 .closest() – first matched element
 .has() – has a filter
 .is() – checks against a selector
 .parent(), .parents()
 .siblings()
 .next()
 .prev()
JQUERY MANIPULATION

 .addClass() – adds a class to an element
 .removeClass() – remove a class from an element
 .append() – inserts content
 .appendTo() – appends element to selector
 .remove() – removes selected element from DOM
 .val(“some text”) – sets value of element
 .html(“some text”) – sets HTML of element
 .prop() – gets a property of element
 .attr() – gets an attribute of element
 .data() – gets a data attribute of an element
JQUERY EVENTS

 Bind to DOM events
   click, hover, focus, keydown, select, submit
 Three main methods to attach event
  $(document).ready(function(){
     $(“myElement”).click(function() {
           doSomething(); });
   });
     Fired when the DOM is completely loaded
  $(“myElement”).live(“click”, function() {
   doSomething(); });
     Fired when the element is created in the DOM
  $(“myElement”).on(“click”, function(){
   doSomething();});
     As of jQuery 1.7, the most efficient way of binding
JQUERY EFFECTS

 Used for animating elements on a page
 fadeIn(), fadeOut(), fadeToggle()
 slideUp(), slideDown(), slideToggle()
 show(), hide(), toggle()
 animate() – create custom animations, pass in a
  map of CSS properties; opacity, position, color
JQUERY AJAX

 Used for loading data into the DOM from a server
  request
 Used for sending data to the server
 .ajax() – main method for Ajax methods
 .get() – get data from the server
 .post() – send data to the server
 .serialize() – prepare form data to send
JQUERY AJAX - SETTINGS

 async – defaulted to true
 beforeSend – used to modify the XMLHTTPRequest
  object
 cache – default to true
 contentType – default to application/x-www-form-
  urlencoded
 data – data to be sent to the server
 dataType – xml, json, script, html
 type – GET, POST
 url – where the request is sent
JQUERY AJAX

 .ajaxSend() – attach function to be run before
  request is sent
 .ajaxStart() – handler called when first Ajax request
  begins
 .ajaxStop() – handler called when all Ajax requests
  are completed
 .ajaxSuccess – function to be called on a successful
  request
JQUERY AJAX

$.ajax({
 url: “/UserGroup/GetGroups”,
 type: “GET”,
 dataType: “json”,
 success: function(data){
    // do something with the result
 }
});
DEMOS
JQUERY UI

 Built with jQuery
 Supports IE 6.0+, Chrome, Firefox 3+, Safari 3.1+,
  Opera 9.6+
 Five interactions, eight widgets, various effects and
  utilities
 Themeable
JQUERY UI - INTERACTIONS

 Draggable – Allows DOM element to be dragged
 Droppable – Specifies a DOM element to be target
 Resizeable – Any DOM element to be resizeable
 Selectable – Any DOM element(s) to be selected
 Sortable – Rearrange a list of DOM elements
JQUERY UI - WIDGETS

 Accordion
 Autocomplete
 Button
 Datepicker
 Dialog
 Progressbar
 Slider
 Tabs
JQUERY UI - AUTOCOMPLETE

$(“#element”).autocomplete({
 source: someSource,
 delay: 500,
 minLength: 5
});

 source – the data to use, required. String, array, or callback
 delay – milliseconds before triggering
 minLength – minimum number of characters before triggering
JQUERY UI - DATEPICKER

$(“#element”).datepicker({
 buttonImage: “/images/datepicker.gif”,
 maxDate: “+1m + 1w”,
 constrainInput: true,
 onSelect: function(dateText, inst){
     doSomething();
 }
});

   buttonImage– graphic to use as icon
   maxDate – maximum date allowed
   constrainInput – only characters allowed by dateFormat
   onSelect – function to fire when date is selected
JQUERY UI - DIALOG

$(“#element”).dialog({
 autoOpen: false,
 buttons: { "Ok": function() {
     $(this).dialog("close"); }},
 modal: true,
 minHeight: 300
});

   autoOpen– if true, shows dialog on creation
   buttons– an array of buttons and functions
   modal– other items on page will be disabled
   minHeight– minimum height of dialog
USER EXPERIENCE

 User Registration
   Be as minimal as possible
   Don’t ask for all possible data at start
   Go easy, can always come back for more
USER EXPERIENCE

 Use Ajax/JavaScript to help the user
 Check for existing username before submitting




 Check for existing email and format
USER EXPERIENCE – VALIDATE
                 USERNAME
function validateUserName(elem) {
    var $elem = $(elem);
    var userName = $elem.val();
    var url = "/Account/IsExistingUser/";
    $.get(url, { name: userName }, function (json) {
        if (json) {
            $("#userNameTaken").fadeIn();
            $elem.removeClass("valid")
                  .addClass("invalid");
        } else {
            $("#userNameTaken").fadeOut();
            $elem.removeClass("invalid")
                  .addClass("valid");
        }
    });
}
USER EXPERIENCE – VALIDATE
                 USERNAME

[HttpGet]
public JsonResult IsExistingUser(string name)
{
   return Json(_memberHelper.IsExistingUser (name),
      JsonRequestBehavior.AllowGet );
}
QUESTIONS?
THANK YOU

 Slides are at http://slidesha.re/RichWeb
 James Johnson
 james@latringo.com
 @latringo
 www.latringo.me
 Inland Empire .NET User’s Group
    www.iedotnetug.org
    2 nd Tuesday of each month
    San Bernardino, CA

More Related Content

What's hot

JavaScript!
JavaScript!JavaScript!
JavaScript!RTigger
 
Nothing Hard Baked: Designing the Inclusive Web
Nothing Hard Baked: Designing the Inclusive WebNothing Hard Baked: Designing the Inclusive Web
Nothing Hard Baked: Designing the Inclusive Webcolinbdclark
 
SharePoint and jQuery Essentials
SharePoint and jQuery EssentialsSharePoint and jQuery Essentials
SharePoint and jQuery EssentialsMark Rackley
 
A to Z about JQuery - Become Newbie to Expert Java Developer
A to Z about JQuery - Become Newbie to Expert Java DeveloperA to Z about JQuery - Become Newbie to Expert Java Developer
A to Z about JQuery - Become Newbie to Expert Java DeveloperManoj Bhuva
 
jQuery Features to Avoid
jQuery Features to AvoidjQuery Features to Avoid
jQuery Features to Avoiddmethvin
 
User Interface Development with jQuery
User Interface Development with jQueryUser Interface Development with jQuery
User Interface Development with jQuerycolinbdclark
 
The Inclusive Web: hands-on with HTML5 and jQuery
The Inclusive Web: hands-on with HTML5 and jQueryThe Inclusive Web: hands-on with HTML5 and jQuery
The Inclusive Web: hands-on with HTML5 and jQuerycolinbdclark
 
OOCSS for JavaScript Pirates jQcon Boston
OOCSS for JavaScript Pirates jQcon BostonOOCSS for JavaScript Pirates jQcon Boston
OOCSS for JavaScript Pirates jQcon BostonJohn Hann
 
J query b_dotnet_ug_meet_12_may_2012
J query b_dotnet_ug_meet_12_may_2012J query b_dotnet_ug_meet_12_may_2012
J query b_dotnet_ug_meet_12_may_2012ghnash
 
WordPress for developers - phpday 2011
WordPress for developers -  phpday 2011WordPress for developers -  phpday 2011
WordPress for developers - phpday 2011Maurizio Pelizzone
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQueryZeeshan Khan
 
Intoduction on Playframework
Intoduction on PlayframeworkIntoduction on Playframework
Intoduction on PlayframeworkKnoldus Inc.
 

What's hot (20)

JavaScript!
JavaScript!JavaScript!
JavaScript!
 
jQuery
jQueryjQuery
jQuery
 
Nothing Hard Baked: Designing the Inclusive Web
Nothing Hard Baked: Designing the Inclusive WebNothing Hard Baked: Designing the Inclusive Web
Nothing Hard Baked: Designing the Inclusive Web
 
SharePoint and jQuery Essentials
SharePoint and jQuery EssentialsSharePoint and jQuery Essentials
SharePoint and jQuery Essentials
 
J query training
J query trainingJ query training
J query training
 
A to Z about JQuery - Become Newbie to Expert Java Developer
A to Z about JQuery - Become Newbie to Expert Java DeveloperA to Z about JQuery - Become Newbie to Expert Java Developer
A to Z about JQuery - Become Newbie to Expert Java Developer
 
jQuery Features to Avoid
jQuery Features to AvoidjQuery Features to Avoid
jQuery Features to Avoid
 
User Interface Development with jQuery
User Interface Development with jQueryUser Interface Development with jQuery
User Interface Development with jQuery
 
jQuery Introduction
jQuery IntroductionjQuery Introduction
jQuery Introduction
 
The Inclusive Web: hands-on with HTML5 and jQuery
The Inclusive Web: hands-on with HTML5 and jQueryThe Inclusive Web: hands-on with HTML5 and jQuery
The Inclusive Web: hands-on with HTML5 and jQuery
 
JQuery
JQueryJQuery
JQuery
 
jQuery
jQueryjQuery
jQuery
 
The jQuery Library
The  jQuery LibraryThe  jQuery Library
The jQuery Library
 
jQuery Essentials
jQuery EssentialsjQuery Essentials
jQuery Essentials
 
OOCSS for JavaScript Pirates jQcon Boston
OOCSS for JavaScript Pirates jQcon BostonOOCSS for JavaScript Pirates jQcon Boston
OOCSS for JavaScript Pirates jQcon Boston
 
J query b_dotnet_ug_meet_12_may_2012
J query b_dotnet_ug_meet_12_may_2012J query b_dotnet_ug_meet_12_may_2012
J query b_dotnet_ug_meet_12_may_2012
 
jQuery
jQueryjQuery
jQuery
 
WordPress for developers - phpday 2011
WordPress for developers -  phpday 2011WordPress for developers -  phpday 2011
WordPress for developers - phpday 2011
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
Intoduction on Playframework
Intoduction on PlayframeworkIntoduction on Playframework
Intoduction on Playframework
 

Viewers also liked

Projet Pmb
Projet PmbProjet Pmb
Projet Pmb0351907h
 
Intro to jQuery UI
Intro to jQuery UIIntro to jQuery UI
Intro to jQuery UIappendTo
 
Usability AJAX and other ASP.NET Features
Usability AJAX and other ASP.NET FeaturesUsability AJAX and other ASP.NET Features
Usability AJAX and other ASP.NET FeaturesPeter Gfader
 
Introducing Asp.Net Ajax 4.0 Preview
Introducing Asp.Net Ajax 4.0 PreviewIntroducing Asp.Net Ajax 4.0 Preview
Introducing Asp.Net Ajax 4.0 PreviewCat Chen
 
Learn ASP.NET AJAX in 5 Minutes
Learn ASP.NET AJAX in 5 MinutesLearn ASP.NET AJAX in 5 Minutes
Learn ASP.NET AJAX in 5 Minutescode-kernel
 
Introduction To Asp.Net Ajax
Introduction To Asp.Net AjaxIntroduction To Asp.Net Ajax
Introduction To Asp.Net AjaxJeff Blankenburg
 

Viewers also liked (9)

Projet Pmb
Projet PmbProjet Pmb
Projet Pmb
 
JQuery UI
JQuery UIJQuery UI
JQuery UI
 
Intro to jQuery UI
Intro to jQuery UIIntro to jQuery UI
Intro to jQuery UI
 
ASP.NET, AJAX and jQuery
ASP.NET, AJAX and jQueryASP.NET, AJAX and jQuery
ASP.NET, AJAX and jQuery
 
Usability AJAX and other ASP.NET Features
Usability AJAX and other ASP.NET FeaturesUsability AJAX and other ASP.NET Features
Usability AJAX and other ASP.NET Features
 
Introducing Asp.Net Ajax 4.0 Preview
Introducing Asp.Net Ajax 4.0 PreviewIntroducing Asp.Net Ajax 4.0 Preview
Introducing Asp.Net Ajax 4.0 Preview
 
Learn ASP.NET AJAX in 5 Minutes
Learn ASP.NET AJAX in 5 MinutesLearn ASP.NET AJAX in 5 Minutes
Learn ASP.NET AJAX in 5 Minutes
 
Introduction To Asp.Net Ajax
Introduction To Asp.Net AjaxIntroduction To Asp.Net Ajax
Introduction To Asp.Net Ajax
 
Ajax and ASP.NET AJAX
Ajax and ASP.NET AJAXAjax and ASP.NET AJAX
Ajax and ASP.NET AJAX
 

Similar to A Rich Web experience with jQuery, Ajax and .NET

Week 4 - jQuery + Ajax
Week 4 - jQuery + AjaxWeek 4 - jQuery + Ajax
Week 4 - jQuery + Ajaxbaygross
 
How to increase Performance of Web Application using JQuery
How to increase Performance of Web Application using JQueryHow to increase Performance of Web Application using JQuery
How to increase Performance of Web Application using JQuerykolkatageeks
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQueryJames Johnson
 
QA Fest 2017. Ярослав Святкин. Тестовый фреймворк GEB для тестирования WEB пр...
QA Fest 2017. Ярослав Святкин. Тестовый фреймворк GEB для тестирования WEB пр...QA Fest 2017. Ярослав Святкин. Тестовый фреймворк GEB для тестирования WEB пр...
QA Fest 2017. Ярослав Святкин. Тестовый фреймворк GEB для тестирования WEB пр...QAFest
 
Web Development Introduction to jQuery
Web Development Introduction to jQueryWeb Development Introduction to jQuery
Web Development Introduction to jQueryLaurence Svekis ✔
 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)Doris Chen
 
Introduzione JQuery
Introduzione JQueryIntroduzione JQuery
Introduzione JQueryorestJump
 
jQuery in the [Aol.] Enterprise
jQuery in the [Aol.] EnterprisejQuery in the [Aol.] Enterprise
jQuery in the [Aol.] EnterpriseDave Artz
 
J Query The Write Less Do More Javascript Library
J Query   The Write Less Do More Javascript LibraryJ Query   The Write Less Do More Javascript Library
J Query The Write Less Do More Javascript Libraryrsnarayanan
 
Jquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsJquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsEPAM Systems
 
Javascript first-class citizenery
Javascript first-class citizeneryJavascript first-class citizenery
Javascript first-class citizenerytoddbr
 
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD CombinationLotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD CombinationSean Burgess
 

Similar to A Rich Web experience with jQuery, Ajax and .NET (20)

Week 4 - jQuery + Ajax
Week 4 - jQuery + AjaxWeek 4 - jQuery + Ajax
Week 4 - jQuery + Ajax
 
JavaScript JQUERY AJAX
JavaScript JQUERY AJAXJavaScript JQUERY AJAX
JavaScript JQUERY AJAX
 
How to increase Performance of Web Application using JQuery
How to increase Performance of Web Application using JQueryHow to increase Performance of Web Application using JQuery
How to increase Performance of Web Application using JQuery
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
QA Fest 2017. Ярослав Святкин. Тестовый фреймворк GEB для тестирования WEB пр...
QA Fest 2017. Ярослав Святкин. Тестовый фреймворк GEB для тестирования WEB пр...QA Fest 2017. Ярослав Святкин. Тестовый фреймворк GEB для тестирования WEB пр...
QA Fest 2017. Ярослав Святкин. Тестовый фреймворк GEB для тестирования WEB пр...
 
jQuery
jQueryjQuery
jQuery
 
Geb qa fest2017
Geb qa fest2017Geb qa fest2017
Geb qa fest2017
 
jQuery secrets
jQuery secretsjQuery secrets
jQuery secrets
 
Web Development Introduction to jQuery
Web Development Introduction to jQueryWeb Development Introduction to jQuery
Web Development Introduction to jQuery
 
Jquery fundamentals
Jquery fundamentalsJquery fundamentals
Jquery fundamentals
 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
 
jQuery, CSS3 and ColdFusion
jQuery, CSS3 and ColdFusionjQuery, CSS3 and ColdFusion
jQuery, CSS3 and ColdFusion
 
Introduzione JQuery
Introduzione JQueryIntroduzione JQuery
Introduzione JQuery
 
jQuery in the [Aol.] Enterprise
jQuery in the [Aol.] EnterprisejQuery in the [Aol.] Enterprise
jQuery in the [Aol.] Enterprise
 
Jquery Basics
Jquery BasicsJquery Basics
Jquery Basics
 
J Query The Write Less Do More Javascript Library
J Query   The Write Less Do More Javascript LibraryJ Query   The Write Less Do More Javascript Library
J Query The Write Less Do More Javascript Library
 
Jquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsJquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript Basics
 
Javascript first-class citizenery
Javascript first-class citizeneryJavascript first-class citizenery
Javascript first-class citizenery
 
Unit3.pptx
Unit3.pptxUnit3.pptx
Unit3.pptx
 
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD CombinationLotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
 

More from James Johnson

Entity Framework Database and Code First
Entity Framework Database and Code FirstEntity Framework Database and Code First
Entity Framework Database and Code FirstJames Johnson
 
ASP.NET MVC and Entity Framework 4
ASP.NET MVC and Entity Framework 4ASP.NET MVC and Entity Framework 4
ASP.NET MVC and Entity Framework 4James Johnson
 
MVC and Entity Framework 4
MVC and Entity Framework 4MVC and Entity Framework 4
MVC and Entity Framework 4James Johnson
 
MVC and Entity Framework
MVC and Entity FrameworkMVC and Entity Framework
MVC and Entity FrameworkJames Johnson
 

More from James Johnson (6)

La sql
La sqlLa sql
La sql
 
Entity Framework Database and Code First
Entity Framework Database and Code FirstEntity Framework Database and Code First
Entity Framework Database and Code First
 
Real World MVC
Real World MVCReal World MVC
Real World MVC
 
ASP.NET MVC and Entity Framework 4
ASP.NET MVC and Entity Framework 4ASP.NET MVC and Entity Framework 4
ASP.NET MVC and Entity Framework 4
 
MVC and Entity Framework 4
MVC and Entity Framework 4MVC and Entity Framework 4
MVC and Entity Framework 4
 
MVC and Entity Framework
MVC and Entity FrameworkMVC and Entity Framework
MVC and Entity Framework
 

Recently uploaded

TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 

Recently uploaded (20)

TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 

A Rich Web experience with jQuery, Ajax and .NET

  • 1. A Rich Web Experience With jQuery, Ajax and .NET James Johnson Founder and President, Inland Empire .NET User’s Group Los Angeles .NET Developers Group April 2nd, 2012
  • 2.
  • 3. WHO I AM Founder and President, Inland Empire .NET User’s Group Four-time and current Microsoft MVP – CAD Software developer by day Serial netrepreneur by night
  • 4. JAVASCRIPT  Used to provide interactivity with a web page  Enable programmatic access to a web page  Dynamic  Weakly typed  Prototype-based  Supports closures and higher order function
  • 5. JAVASCRIPT  Not to be confused with Java, it has a similar syntax  {} and ;  First released as LiveScript in September 1995  Renamed to JavaScript in December 1995  Easy to write functions, then copy and paste all over  Quickly one of the most popular languages for web development  But thought of as a kiddy language  Advent of Ajax brought JavaScript attention by “professionals”
  • 6. JAVASCRIPT  Pros  Dynamic  Easy to develop with  Easy to debug  Similar syntax to “real” languages  Cons  Dynamic  Easy to develop with  Every browser seems to have it’s own JavaScript engine  Difficult to have same behaviours across browsers
  • 7. JAVASCRIPT LIBRARIES  Pre-written JavaScript controls  Easier development  Many, many libraries  Dojo, Echo, Ext, Google Web Toolkit, jQuery, MochiKit, MooTools, Prototype, qooxdoo, Rico, script.aculo.us, Spry, Yahoo! UI Library
  • 8. JQUERY  Released in January 2006 by John Resig  Free, open source, dual-licensed under MIT and GNU  Syntax is easier to navigate the DOM  Handles events, creates animations, modify attributes  Ajax grooviness baked in  Used by over 39% of the top 10,000 websites  Microsoft bundles with ASP.NET Ajax and ASP.NET MVC  Full support from Microsoft
  • 9. JQUERY BENEFITS  Fast development  Solid, standardized library  Gracefully fails – no glaring errors or frozen pages  Lots and lots and lots of examples  Very easy to grok  All the cool kids use it  Intellisense with –vsdoc.js
  • 10. JQUERY SYNTAX  $(“some element”) or jQuery(“some element”)  Can select by ID or className  $(“#myElement”) gets the only ID=“myElement”  $(“div.myElement”) gets all divs with class=“myElement”  Easy to traverse  $(“div.main ul li”) – all <li> within div class=“main”  $(“div.main”).find(“li”) – same as above  $(“div.main”).find(“li:odd”) – same as above but only ODD elements – zero-based
  • 11. JQUERY SELECTORS  Matching a set of document elements  :checkbox, :eq(n), :even, :has(), :first, :last, :focus, :not() $(“input:not(:checked)”); $(“.myClass:even”); $(“input:checkbox”); $(“.my-class:has(p)”); $(“input[type=„text‟]”);
  • 12. JQUERY CHAINING  Once an element is found, reference is kept  Instead of $(“div.myElement”).hide(); $(“div.myElement”).html(“hi”); $(“div.myElement”).addClass(“red”); $(“div.myElement”).fadeIn(“slow”);  Chain the actions $(“div.myElement”).hide().html(“hi”) .addClass(“red”).fadeIn(“slow”);
  • 13. JQUERY TRAVERSING  .children() – all child elements, optional filter  .each() – iterate through a collection of matched elements  .find() – get descendants of element  .closest() – first matched element  .has() – has a filter  .is() – checks against a selector  .parent(), .parents()  .siblings()  .next()  .prev()
  • 14. JQUERY MANIPULATION  .addClass() – adds a class to an element  .removeClass() – remove a class from an element  .append() – inserts content  .appendTo() – appends element to selector  .remove() – removes selected element from DOM  .val(“some text”) – sets value of element  .html(“some text”) – sets HTML of element  .prop() – gets a property of element  .attr() – gets an attribute of element  .data() – gets a data attribute of an element
  • 15. JQUERY EVENTS  Bind to DOM events  click, hover, focus, keydown, select, submit  Three main methods to attach event $(document).ready(function(){ $(“myElement”).click(function() { doSomething(); }); });  Fired when the DOM is completely loaded $(“myElement”).live(“click”, function() { doSomething(); });  Fired when the element is created in the DOM $(“myElement”).on(“click”, function(){ doSomething();});  As of jQuery 1.7, the most efficient way of binding
  • 16. JQUERY EFFECTS  Used for animating elements on a page  fadeIn(), fadeOut(), fadeToggle()  slideUp(), slideDown(), slideToggle()  show(), hide(), toggle()  animate() – create custom animations, pass in a map of CSS properties; opacity, position, color
  • 17. JQUERY AJAX  Used for loading data into the DOM from a server request  Used for sending data to the server  .ajax() – main method for Ajax methods  .get() – get data from the server  .post() – send data to the server  .serialize() – prepare form data to send
  • 18. JQUERY AJAX - SETTINGS  async – defaulted to true  beforeSend – used to modify the XMLHTTPRequest object  cache – default to true  contentType – default to application/x-www-form- urlencoded  data – data to be sent to the server  dataType – xml, json, script, html  type – GET, POST  url – where the request is sent
  • 19. JQUERY AJAX  .ajaxSend() – attach function to be run before request is sent  .ajaxStart() – handler called when first Ajax request begins  .ajaxStop() – handler called when all Ajax requests are completed  .ajaxSuccess – function to be called on a successful request
  • 20. JQUERY AJAX $.ajax({ url: “/UserGroup/GetGroups”, type: “GET”, dataType: “json”, success: function(data){ // do something with the result } });
  • 21. DEMOS
  • 22. JQUERY UI  Built with jQuery  Supports IE 6.0+, Chrome, Firefox 3+, Safari 3.1+, Opera 9.6+  Five interactions, eight widgets, various effects and utilities  Themeable
  • 23. JQUERY UI - INTERACTIONS  Draggable – Allows DOM element to be dragged  Droppable – Specifies a DOM element to be target  Resizeable – Any DOM element to be resizeable  Selectable – Any DOM element(s) to be selected  Sortable – Rearrange a list of DOM elements
  • 24. JQUERY UI - WIDGETS  Accordion  Autocomplete  Button  Datepicker  Dialog  Progressbar  Slider  Tabs
  • 25. JQUERY UI - AUTOCOMPLETE $(“#element”).autocomplete({ source: someSource, delay: 500, minLength: 5 });  source – the data to use, required. String, array, or callback  delay – milliseconds before triggering  minLength – minimum number of characters before triggering
  • 26. JQUERY UI - DATEPICKER $(“#element”).datepicker({ buttonImage: “/images/datepicker.gif”, maxDate: “+1m + 1w”, constrainInput: true, onSelect: function(dateText, inst){ doSomething(); } });  buttonImage– graphic to use as icon  maxDate – maximum date allowed  constrainInput – only characters allowed by dateFormat  onSelect – function to fire when date is selected
  • 27. JQUERY UI - DIALOG $(“#element”).dialog({ autoOpen: false, buttons: { "Ok": function() { $(this).dialog("close"); }}, modal: true, minHeight: 300 });  autoOpen– if true, shows dialog on creation  buttons– an array of buttons and functions  modal– other items on page will be disabled  minHeight– minimum height of dialog
  • 28. USER EXPERIENCE  User Registration  Be as minimal as possible  Don’t ask for all possible data at start  Go easy, can always come back for more
  • 29. USER EXPERIENCE  Use Ajax/JavaScript to help the user  Check for existing username before submitting  Check for existing email and format
  • 30. USER EXPERIENCE – VALIDATE USERNAME function validateUserName(elem) { var $elem = $(elem); var userName = $elem.val(); var url = "/Account/IsExistingUser/"; $.get(url, { name: userName }, function (json) { if (json) { $("#userNameTaken").fadeIn(); $elem.removeClass("valid") .addClass("invalid"); } else { $("#userNameTaken").fadeOut(); $elem.removeClass("invalid") .addClass("valid"); } }); }
  • 31. USER EXPERIENCE – VALIDATE USERNAME [HttpGet] public JsonResult IsExistingUser(string name) { return Json(_memberHelper.IsExistingUser (name), JsonRequestBehavior.AllowGet ); }
  • 33. THANK YOU  Slides are at http://slidesha.re/RichWeb  James Johnson  james@latringo.com  @latringo  www.latringo.me  Inland Empire .NET User’s Group  www.iedotnetug.org  2 nd Tuesday of each month  San Bernardino, CA