WCF & JQuery

11
WCF & JQUERY Chris Love Tellago Inc. http://ProfessionalASPNET.com http://Twitter.com/ChrisLove

description

Slide deck that is part of my WCF JQuery presentation.

Transcript of WCF & JQuery

Page 1: WCF & JQuery

WCF & JQUERY

Chris LoveTellago Inc.http://ProfessionalASPNET.comhttp://Twitter.com/ChrisLove

Page 2: WCF & JQuery

BOOKS

Page 3: WCF & JQuery

REFERENCES Rick Strahl – Smart Dude

http://west-wind.com Don Demsak (DonXML) – Wise Guy

http://donxml.com John Resig – The JQuery Creator (pay

homage here)

Page 4: WCF & JQuery

TOUCHING ON WCF All About the Messages Can be Rather Complicated

Configuration Attributes Debugging

Making Things Easier Astoria oData

Page 5: WCF & JQuery

WCF COMPONENTS Contracts Data & Models Factories Endpoints The Attributes…

Page 6: WCF & JQuery

JQUERY AJAX FEATURES Very Flexible Global Event Handlers Graceful Event Handling All the Super Goodness Baked into

JQuery!!!

Page 7: WCF & JQuery

JSON The Data Format LCD Simple (And that’s the way I

like it!) WCF Just Handles it for Us! JSON2 from Crockford http://JSON.org

Page 8: WCF & JQuery

JQUERY TEMPLATING Cloning

var newEl = $("# ContactRowTemplate ").clone() .attr("id",item.ContactId) .fadeIn("slow");

jTemplates Python-Like Syntax

MicroTemplating

$("#tblContactList tbody").empty() .html($("#ContactRowTemplate") .parseTemplate({ contacts: response.Contacts }));

http://ejohn.org/blog/javascript-micro-templating/http://www.west-wind.com/Weblog/posts/509108.aspx

Page 9: WCF & JQuery

JQUERY TEMPLATING<script id="ContactRowTemplate" type="text/html"> <# for(var i=0; i < contacts.length; i++) { var contact = contacts[i]; #> <tr> <td> <#=contact.FirstName#> <#=contact.LastName#> </td> <td> <#=contact.City#> </td> <td> <#=contact.State#> </td> <td><img src="images/edit.gif" onclick="GetContactInfo(<#=contact.ContactId#>);" /></td> </tr> <# } #> </script>

Page 10: WCF & JQuery

JQUERY GLOBAL AJAX STUFF Jquery.ajax .ajaxComplete() .ajaxError() .ajaxSend() .ajaxStart() .ajaxSuccess()

$(document).ready(function() { ajaxLog.ajaxStart(function(evt, request, settings) { var dt = new Date(); $(this).append("<br/><hr/>Starting request... " + dt.toLocaleString()); });});

Page 11: WCF & JQuery

DEBUGGING TOOLS Visual Studio Fiddler IE 8 or FireFox w/Firebug Learn Common Errors/Exceptions

Use Try Catch Don’t Make JavaScript Typos