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
A Rich Web Experience with jQuery, Ajax and .NET
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
Ad

More Related Content

What's hot (20)

J query training
J query trainingJ query training
J query training
FIS - Fidelity Information Services
 
Unobtrusive javascript with jQuery
Unobtrusive javascript with jQueryUnobtrusive javascript with jQuery
Unobtrusive javascript with jQuery
Angel 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 Introduction
jQuery IntroductionjQuery Introduction
jQuery Introduction
Arwid Bancewicz
 
jQuery
jQueryjQuery
jQuery
Jay Poojara
 
jQuery
jQueryjQuery
jQuery
Dileep Mishra
 
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
 
jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginners
Siva Arunachalam
 
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
 
Unobtrusive javascript with jQuery
Unobtrusive javascript with jQueryUnobtrusive javascript with jQuery
Unobtrusive javascript with jQuery
Angel 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
 
Web Development Introduction to jQuery
Web Development Introduction to jQueryWeb Development Introduction to jQuery
Web Development Introduction to jQuery
Laurence Svekis ✔
 
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
 
User Interface Development with jQuery
User Interface Development with jQueryUser Interface Development with jQuery
User Interface Development with jQuery
colinbdclark
 
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.
 
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
 

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
baygross
 
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
jQuery
Ivano Malavolta
 
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
 
Jquery fundamentals
Jquery fundamentalsJquery fundamentals
Jquery fundamentals
Salvatore Fazio
 
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
JqueryJquery
Jquery
Pankaj Srivastava
 
Jquery beltranhomewrok
Jquery beltranhomewrokJquery beltranhomewrok
Jquery beltranhomewrok
Catherine Beltran
 
Jquery beltranhomewrok
Jquery beltranhomewrokJquery beltranhomewrok
Jquery beltranhomewrok
Catherine Beltran
 
JQuery Overview
JQuery OverviewJQuery Overview
JQuery Overview
Mahmoud Tolba
 
Week 4 - jQuery + Ajax
Week 4 - jQuery + AjaxWeek 4 - jQuery + Ajax
Week 4 - jQuery + Ajax
baygross
 
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
 
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 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 in the [Aol.] Enterprise
jQuery in the [Aol.] EnterprisejQuery in the [Aol.] Enterprise
jQuery in the [Aol.] Enterprise
Dave Artz
 
Ad

More from James Johnson (6)

La sql
La sqlLa sql
La sql
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
 
Real World MVC
Real World MVCReal World MVC
Real World MVC
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
 
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
 
Ad

Recently uploaded (20)

AI 3-in-1: Agents, RAG, and Local Models - Brent Laster
AI 3-in-1: Agents, RAG, and Local Models - Brent LasterAI 3-in-1: Agents, RAG, and Local Models - Brent Laster
AI 3-in-1: Agents, RAG, and Local Models - Brent Laster
All Things Open
 
Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)
Kaya Weers
 
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
James Anderson
 
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Christian Folini
 
Build With AI - In Person Session Slides.pdf
Build With AI - In Person Session Slides.pdfBuild With AI - In Person Session Slides.pdf
Build With AI - In Person Session Slides.pdf
Google Developer Group - Harare
 
AI-proof your career by Olivier Vroom and David WIlliamson
AI-proof your career by Olivier Vroom and David WIlliamsonAI-proof your career by Olivier Vroom and David WIlliamson
AI-proof your career by Olivier Vroom and David WIlliamson
UXPA Boston
 
Bepents tech services - a premier cybersecurity consulting firm
Bepents tech services - a premier cybersecurity consulting firmBepents tech services - a premier cybersecurity consulting firm
Bepents tech services - a premier cybersecurity consulting firm
Benard76
 
Unlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web AppsUnlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web Apps
Maximiliano Firtman
 
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Maarten Verwaest
 
Dark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanizationDark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanization
Jakub Šimek
 
Agentic Automation - Delhi UiPath Community Meetup
Agentic Automation - Delhi UiPath Community MeetupAgentic Automation - Delhi UiPath Community Meetup
Agentic Automation - Delhi UiPath Community Meetup
Manoj Batra (1600 + Connections)
 
Top-AI-Based-Tools-for-Game-Developers (1).pptx
Top-AI-Based-Tools-for-Game-Developers (1).pptxTop-AI-Based-Tools-for-Game-Developers (1).pptx
Top-AI-Based-Tools-for-Game-Developers (1).pptx
BR Softech
 
Slack like a pro: strategies for 10x engineering teams
Slack like a pro: strategies for 10x engineering teamsSlack like a pro: strategies for 10x engineering teams
Slack like a pro: strategies for 10x engineering teams
Nacho Cougil
 
Viam product demo_ Deploying and scaling AI with hardware.pdf
Viam product demo_ Deploying and scaling AI with hardware.pdfViam product demo_ Deploying and scaling AI with hardware.pdf
Viam product demo_ Deploying and scaling AI with hardware.pdf
camilalamoratta
 
Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Kit-Works Team Study_아직도 Dockefile.pdf_김성호Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Wonjun Hwang
 
How to Install & Activate ListGrabber - eGrabber
How to Install & Activate ListGrabber - eGrabberHow to Install & Activate ListGrabber - eGrabber
How to Install & Activate ListGrabber - eGrabber
eGrabber
 
May Patch Tuesday
May Patch TuesdayMay Patch Tuesday
May Patch Tuesday
Ivanti
 
fennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solutionfennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solution
shallal2
 
machines-for-woodworking-shops-en-compressed.pdf
machines-for-woodworking-shops-en-compressed.pdfmachines-for-woodworking-shops-en-compressed.pdf
machines-for-woodworking-shops-en-compressed.pdf
AmirStern2
 
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Raffi Khatchadourian
 
AI 3-in-1: Agents, RAG, and Local Models - Brent Laster
AI 3-in-1: Agents, RAG, and Local Models - Brent LasterAI 3-in-1: Agents, RAG, and Local Models - Brent Laster
AI 3-in-1: Agents, RAG, and Local Models - Brent Laster
All Things Open
 
Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)
Kaya Weers
 
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
James Anderson
 
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Christian Folini
 
AI-proof your career by Olivier Vroom and David WIlliamson
AI-proof your career by Olivier Vroom and David WIlliamsonAI-proof your career by Olivier Vroom and David WIlliamson
AI-proof your career by Olivier Vroom and David WIlliamson
UXPA Boston
 
Bepents tech services - a premier cybersecurity consulting firm
Bepents tech services - a premier cybersecurity consulting firmBepents tech services - a premier cybersecurity consulting firm
Bepents tech services - a premier cybersecurity consulting firm
Benard76
 
Unlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web AppsUnlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web Apps
Maximiliano Firtman
 
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Maarten Verwaest
 
Dark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanizationDark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanization
Jakub Šimek
 
Top-AI-Based-Tools-for-Game-Developers (1).pptx
Top-AI-Based-Tools-for-Game-Developers (1).pptxTop-AI-Based-Tools-for-Game-Developers (1).pptx
Top-AI-Based-Tools-for-Game-Developers (1).pptx
BR Softech
 
Slack like a pro: strategies for 10x engineering teams
Slack like a pro: strategies for 10x engineering teamsSlack like a pro: strategies for 10x engineering teams
Slack like a pro: strategies for 10x engineering teams
Nacho Cougil
 
Viam product demo_ Deploying and scaling AI with hardware.pdf
Viam product demo_ Deploying and scaling AI with hardware.pdfViam product demo_ Deploying and scaling AI with hardware.pdf
Viam product demo_ Deploying and scaling AI with hardware.pdf
camilalamoratta
 
Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Kit-Works Team Study_아직도 Dockefile.pdf_김성호Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Wonjun Hwang
 
How to Install & Activate ListGrabber - eGrabber
How to Install & Activate ListGrabber - eGrabberHow to Install & Activate ListGrabber - eGrabber
How to Install & Activate ListGrabber - eGrabber
eGrabber
 
May Patch Tuesday
May Patch TuesdayMay Patch Tuesday
May Patch Tuesday
Ivanti
 
fennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solutionfennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solution
shallal2
 
machines-for-woodworking-shops-en-compressed.pdf
machines-for-woodworking-shops-en-compressed.pdfmachines-for-woodworking-shops-en-compressed.pdf
machines-for-woodworking-shops-en-compressed.pdf
AmirStern2
 
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Raffi Khatchadourian
 

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
  • 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