J Query
J Query
Nathaniel T. Schutta
Who am I?
Nathaniel T. Schutta
http://www.ntschutta.com/jat/
@ntschutta
Foundations of Ajax & Pro Ajax and Java
Frameworks
UI guy
Author, speaker, teacher
More than a couple of web apps
The Plan
Why a library?
Pros and cons.
Ajax made easy.
CSS selectors.
Events.
Animations and effects.
Widgets.
Use a library.
But...doesnt mean we
should go it alone.
Paradox of choice.
<cough>IE 6.</cough>
SharePoint 2010 - no IE 6.
http://blogs.msdn.com/sharepoint/archive/2009/05/07/announcingsharepoint-server-2010-preliminary-system-requirements.aspx
Google Apps...sorry IE 6.
http://googledocs.blogspot.com/2010/01/web-browsersupport-for-docs-and-sites.html
VM as it were.
Libraries = leverage.
Most have:
XHR wrapper.
CSS selectors.
Event handling.
JavaScript utilities.
Ask yourself...
Widgets? Complete
environment? Utilities?
Does it solve
YOUR problems?
Why jQuery?
Small.
Readable code.
Excellent documentation.
Widely used.
jQuery - bit of a
reaction to Prototype.
Focussed on
HTML elements.
Doesnt pollute
global namespace.
Extensive plugins.
Widely used in a
variety of projects.
Parameter ordering in
APIs not always intuitive.
Some functions
reassign this.
jQuerys approach.
Variety of methods.
$.ajax(options)
$.getJSON(url,
[data], [callback])
$.get("/DesigningForAjax/validate",
{
zip: $("#zip").val(),
city: $("#city").val(),
state: $("#state").val()
},
function(message) {
$("#messages").html(message);
});
JavaScript lacks
namespaces - thus $.
Readable?
Easy?
CSS selectors.
Want everything
with a given style?
Browser support
can be lacking...
jQuery excels at
CSS selectors.
Outstanding performance.
$(function(){
$('.header').click(function() {
$(this).next().toggle("blind", { direction: "vertical" }, 500);
});
});
Readable?
Event handling.
Unobtrusive JavaScript.
http://www.alistapart.com/articles/behavioralseparation
jQuery includes a
variety of APIs.
$(function(){
$('.header').click(function() {
$(this).next().toggle("blind", { direction: "vertical" }, 500);
});
});
Want animations
and widgets?
jQuery UI.
Gives us widgets,
effects, draggable etc.
$(function(){
$('.header').click(function() {
$(this).next().toggle("blind", { direction: "vertical" }, 500);
});
});
Very easy to
add a little flash.
Date picker.
Pretty limited.
We have options!
http://www.flickr.com/photos/ramdac/373881476/
by Jason Gulledge
No worries.
Constructors take
optional configuration.
For example...
No problem!
http://www.flickr.com/photos/ramdac/373881476/
by Jason Gulledge
Supports localization.
Dialog.
Modality.
Do your users?
Looks like a
popup...but its not.
Download builder!
Handles dependencies.
Themes.
ThemeRoller.
http://jqueryui.com/themeroller/
Tweak away!
WYSIWYG.
Plugins.
Weve looked at a
couple of widgets.
Hundreds of extensions.
Searchable.
User ratings.
Paradox of choice?
Variable quality...
Compatibility issues.
http://twitter.com/bsbodden/status/9155328185
Very extensible.
Help!
http://docs.jquery.com/Main_Page
Good tutorials.
Plenty of books.
Google friendly ;)
Easy to read.
http://docs.jquery.com/Discussion
Great library.
It depends!
Questions?!?
Thanks!
Please complete your surveys.