WCF & JQuery

Post on 15-May-2015

2.944 views 3 download

description

Slide deck that is part of my WCF JQuery presentation.

Transcript of WCF & JQuery

WCF & JQUERY

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

BOOKS

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)

TOUCHING ON WCF All About the Messages Can be Rather Complicated

Configuration Attributes Debugging

Making Things Easier Astoria oData

WCF COMPONENTS Contracts Data & Models Factories Endpoints The Attributes…

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

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

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

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>

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()); });});

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

Use Try Catch Don’t Make JavaScript Typos