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


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

San Francisco .NET Developers User Group
March 28th, 2012
WHO I AM

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

jQuery
Ajax
User Experience
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
JQUERY UI - THEMES

 24 pre-built themes
 Can create new, or edit existing
JQUERY UI - THEMES

 Modify CSS for new theme
 Download and give name
JQUERY UI - THEMES

   Add to project
<link rel="stylesheet" type="text/css" href="@Url.Content("~/Content/themes/usergroups/jquery-ui-
1.8.17.custom.css")" />
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?

 Slides are at http://slidesha.re/RichWeb
THANK YOU

 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

Unobtrusive javascript with jQuery
Unobtrusive javascript with jQueryUnobtrusive javascript with jQuery
Unobtrusive javascript with jQueryAngel Ruiz
 
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
ghnash
 
Organizing Code with JavascriptMVC
Organizing Code with JavascriptMVCOrganizing Code with JavascriptMVC
Organizing Code with JavascriptMVC
Thomas Reynolds
 
jQuery
jQueryjQuery
jQuery
Jay Poojara
 
jQuery
jQueryjQuery
Web Development Introduction to jQuery
Web Development Introduction to jQueryWeb Development Introduction to jQuery
Web Development Introduction to jQuery
Laurence Svekis ✔
 
JQuery
JQueryJQuery
JQuery
DevTalk
 
jQuery Features to Avoid
jQuery Features to AvoidjQuery Features to Avoid
jQuery Features to Avoid
dmethvin
 
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
colinbdclark
 
JavaScript!
JavaScript!JavaScript!
JavaScript!
RTigger
 
The jQuery Library
The  jQuery LibraryThe  jQuery Library
The jQuery Library
LearnNowOnline
 
User Interface Development with jQuery
User Interface Development with jQueryUser Interface Development with jQuery
User Interface Development with jQuery
colinbdclark
 
jQuery
jQueryjQuery
jQuery
Vishwa Mohan
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
Zeeshan Khan
 
Intoduction on Playframework
Intoduction on PlayframeworkIntoduction on Playframework
Intoduction on Playframework
Knoldus Inc.
 
jQuery Essentials
jQuery EssentialsjQuery Essentials
jQuery Essentials
Bedis ElAchèche
 
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
colinbdclark
 

What's hot (20)

J query training
J query trainingJ query training
J query training
 
Unobtrusive javascript with jQuery
Unobtrusive javascript with jQueryUnobtrusive javascript with jQuery
Unobtrusive javascript with jQuery
 
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
 
Organizing Code with JavascriptMVC
Organizing Code with JavascriptMVCOrganizing Code with JavascriptMVC
Organizing Code with JavascriptMVC
 
jQuery Introduction
jQuery IntroductionjQuery Introduction
jQuery Introduction
 
jQuery
jQueryjQuery
jQuery
 
jQuery
jQueryjQuery
jQuery
 
Web Development Introduction to jQuery
Web Development Introduction to jQueryWeb Development Introduction to jQuery
Web Development Introduction to jQuery
 
JQuery
JQueryJQuery
JQuery
 
jQuery Features to Avoid
jQuery Features to AvoidjQuery Features to Avoid
jQuery Features to Avoid
 
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
 
JavaScript!
JavaScript!JavaScript!
JavaScript!
 
The jQuery Library
The  jQuery LibraryThe  jQuery Library
The jQuery Library
 
User Interface Development with jQuery
User Interface Development with jQueryUser Interface Development with jQuery
User Interface Development with jQuery
 
jQuery
jQueryjQuery
jQuery
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginners
 
Intoduction on Playframework
Intoduction on PlayframeworkIntoduction on Playframework
Intoduction on Playframework
 
jQuery Essentials
jQuery EssentialsjQuery Essentials
jQuery Essentials
 
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
 

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 JQuery
kolkatageeks
 
JavaScript JQUERY AJAX
JavaScript JQUERY AJAXJavaScript JQUERY AJAX
JavaScript JQUERY AJAX
Makarand Bhatambarekar
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
James Johnson
 
QA Fest 2017. Ярослав Святкин. Тестовый фреймворк GEB для тестирования WEB пр...
QA Fest 2017. Ярослав Святкин. Тестовый фреймворк GEB для тестирования WEB пр...QA Fest 2017. Ярослав Святкин. Тестовый фреймворк GEB для тестирования WEB пр...
QA Fest 2017. Ярослав Святкин. Тестовый фреймворк GEB для тестирования WEB пр...
QAFest
 
jQuery
jQueryjQuery
Geb qa fest2017
Geb qa fest2017Geb qa fest2017
Geb qa fest2017
Sviatkin Yaroslav
 
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
EPAM Systems
 
Introduzione JQuery
Introduzione JQueryIntroduzione JQuery
Introduzione JQuery
orestJump
 
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
 
J Query (Complete Course) by Muhammad Ehtisham Siddiqui
J Query (Complete Course) by Muhammad Ehtisham SiddiquiJ Query (Complete Course) by Muhammad Ehtisham Siddiqui
J Query (Complete Course) by Muhammad Ehtisham Siddiqui
Muhammad Ehtisham Siddiqui
 
jQuery, CSS3 and ColdFusion
jQuery, CSS3 and ColdFusionjQuery, CSS3 and ColdFusion
jQuery, CSS3 and ColdFusion
Denard Springle IV
 
Jquery Basics
Jquery BasicsJquery Basics
Jquery Basics
Umeshwaran V
 
Unit3.pptx
Unit3.pptxUnit3.pptx
Unit3.pptx
AnamikaRai59
 
jQuery in the [Aol.] Enterprise
jQuery in the [Aol.] EnterprisejQuery in the [Aol.] Enterprise
jQuery in the [Aol.] Enterprise
Dave Artz
 
JQuery Overview
JQuery OverviewJQuery Overview
JQuery Overview
Mahmoud Tolba
 

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
 
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
 
JavaScript JQUERY AJAX
JavaScript JQUERY AJAXJavaScript JQUERY AJAX
JavaScript JQUERY AJAX
 
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 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
 
Introduzione JQuery
Introduzione JQueryIntroduzione JQuery
Introduzione JQuery
 
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 fundamentals
Jquery fundamentalsJquery fundamentals
Jquery fundamentals
 
J Query (Complete Course) by Muhammad Ehtisham Siddiqui
J Query (Complete Course) by Muhammad Ehtisham SiddiquiJ Query (Complete Course) by Muhammad Ehtisham Siddiqui
J Query (Complete Course) by Muhammad Ehtisham Siddiqui
 
jQuery, CSS3 and ColdFusion
jQuery, CSS3 and ColdFusionjQuery, CSS3 and ColdFusion
jQuery, CSS3 and ColdFusion
 
Jquery Basics
Jquery BasicsJquery Basics
Jquery Basics
 
Unit3.pptx
Unit3.pptxUnit3.pptx
Unit3.pptx
 
jQuery in the [Aol.] Enterprise
jQuery in the [Aol.] EnterprisejQuery in the [Aol.] Enterprise
jQuery in the [Aol.] Enterprise
 
Jquery
JqueryJquery
Jquery
 
Jquery beltranhomewrok
Jquery beltranhomewrokJquery beltranhomewrok
Jquery beltranhomewrok
 
Jquery beltranhomewrok
Jquery beltranhomewrokJquery beltranhomewrok
Jquery beltranhomewrok
 
JQuery Overview
JQuery OverviewJQuery Overview
JQuery Overview
 

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 First
James 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 4
James Johnson
 
MVC and Entity Framework 4
MVC and Entity Framework 4MVC and Entity Framework 4
MVC and Entity Framework 4
James Johnson
 
MVC and Entity Framework
MVC and Entity FrameworkMVC and Entity Framework
MVC and Entity Framework
James 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

SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
UiPathCommunity
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
Vlad Stirbu
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 

Recently uploaded (20)

SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 

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 San Francisco .NET Developers User Group March 28th, 2012
  • 2.
  • 3. WHO I AM Founder and President, Inland Empire .NET User’s Group Three-time and current Microsoft MVP – CAD Software developer by day Serial netrepreneur by night
  • 5. 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
  • 6. 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”
  • 7. 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
  • 8. 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
  • 9. 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
  • 10. 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
  • 11. 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
  • 12. 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‟]”);
  • 13. 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”);
  • 14. 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()
  • 15. 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
  • 16. 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
  • 17. 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
  • 18. 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
  • 19. 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
  • 20. 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
  • 21. JQUERY AJAX $.ajax({ url: “/UserGroup/GetGroups”, type: “GET”, dataType: “json”, success: function(data){ // do something with the result } });
  • 22. DEMOS
  • 23. 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
  • 24. 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
  • 25. JQUERY UI - WIDGETS  Accordion  Autocomplete  Button  Datepicker  Dialog  Progressbar  Slider  Tabs
  • 26. 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
  • 27. 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
  • 28. 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
  • 29. JQUERY UI - THEMES  24 pre-built themes  Can create new, or edit existing
  • 30. JQUERY UI - THEMES  Modify CSS for new theme  Download and give name
  • 31. JQUERY UI - THEMES  Add to project <link rel="stylesheet" type="text/css" href="@Url.Content("~/Content/themes/usergroups/jquery-ui- 1.8.17.custom.css")" />
  • 32. 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
  • 33. USER EXPERIENCE  Use Ajax/JavaScript to help the user  Check for existing username before submitting  Check for existing email and format
  • 34. 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"); } }); }
  • 35. USER EXPERIENCE – VALIDATE USERNAME [HttpGet] public JsonResult IsExistingUser(string name) { return Json(_memberHelper.IsExistingUser (name), JsonRequestBehavior.AllowGet ); }
  • 36. QUESTIONS?  Slides are at http://slidesha.re/RichWeb
  • 37. THANK YOU  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