14
AJAX AJAX MIS 424 Professor Sandvig

AJAX MIS 424 MIS 424 Professor Sandvig Professor Sandvig

  • View
    233

  • Download
    1

Embed Size (px)

Citation preview

Page 1: AJAX MIS 424 MIS 424 Professor Sandvig Professor Sandvig

AJAXAJAXMIS 424

Professor Sandvig

Page 2: AJAX MIS 424 MIS 424 Professor Sandvig Professor Sandvig

TodayToday

1.1. What is AJAXWhat is AJAX

2.2. Benefits & UsesBenefits & Uses

3.3. ImplementationImplementation1.1. Do-it-yourselfDo-it-yourself

2.2. Download APIDownload API

3.3. ASP.NET AjaxASP.NET Ajax

4.4. SummarySummary

Page 3: AJAX MIS 424 MIS 424 Professor Sandvig Professor Sandvig

What is AJAXWhat is AJAX

AcronymAcronym AAsynchronous synchronous JJavaScript avaScript AAnd nd XXMLML

What it isWhat it is JavaScript in web page retrieves data from JavaScript in web page retrieves data from

serverserver Data format is XMLData format is XML Allows partial page refreshAllows partial page refresh

Reduces need to refresh entire pageReduces need to refresh entire page

Page 4: AJAX MIS 424 MIS 424 Professor Sandvig Professor Sandvig

Benefits & UsesBenefits & Uses

Benefits:Benefits: Richer experience for userRicher experience for user More like using desktop applicationMore like using desktop application

UsesUses Google Suggest Google Maps Cascading Menus (Cascading Menus (Kelly Blue Book)) REI product image (menu is JavaScript) (menu is JavaScript) Google DocsGoogle Docs etc. etc.etc. etc.

Page 5: AJAX MIS 424 MIS 424 Professor Sandvig Professor Sandvig

ImplementationImplementation

Options:Options:

1.1. Do-it-yourselfDo-it-yourself Lightweight, flexibleLightweight, flexible write or modify JavaScript or jQuerywrite or modify JavaScript or jQuery

2.2. Use APIUse API1.1. Google, Yahoo, Highslide, …Google, Yahoo, Highslide, …

3.3. ASP.NET AJAXASP.NET AJAX drag & drop in VSdrag & drop in VS convenientconvenient adds a lot of code to applicationadds a lot of code to application

Page 6: AJAX MIS 424 MIS 424 Professor Sandvig Professor Sandvig

Do it yourselfDo it yourself

ClientClientInclude JavaScript or jQuery in web pageInclude JavaScript or jQuery in web page

Requests data from serverRequests data from server

ServerServerWeb service provides dataWeb service provides data

Format: XML, JSON, HTML, …Format: XML, JSON, HTML, …

Page 7: AJAX MIS 424 MIS 424 Professor Sandvig Professor Sandvig

Do it yourselfDo it yourself

BenefitsBenefits FlexibleFlexible LightweightLightweight

DrawbacksDrawbacks Time consumingTime consuming Some knowledge of JavaScript/jQuerySome knowledge of JavaScript/jQuery

Page 8: AJAX MIS 424 MIS 424 Professor Sandvig Professor Sandvig

Do it Yourself ExamplesDo it Yourself Examples

JavaScript Jquery

XML ZipCodesForCity.asmx

AJAXZipCode.aspx

CityZipsQueryXml.aspx

HTML Bookstore

JSON AjaxZipCode

Home grown CarParts.com

Page 9: AJAX MIS 424 MIS 424 Professor Sandvig Professor Sandvig

Use AJAX APIUse AJAX API

Ajax applications written by othersAjax applications written by others Google AJAX APIsGoogle AJAX APIs

SearchSearch

MapsMaps

CalendarCalendar Facebook APIsFacebook APIs

Page 10: AJAX MIS 424 MIS 424 Professor Sandvig Professor Sandvig

ASP.NET AJAXASP.NET AJAX

ASP.NET provides built-in AJAX ASP.NET provides built-in AJAX functionalityfunctionality

Two flavors:Two flavors: Built into some Data ControlsBuilt into some Data Controls

LimitationsLimitations ScriptManager & Update PanelScriptManager & Update Panel

Very flexibleVery flexible

Page 11: AJAX MIS 424 MIS 424 Professor Sandvig Professor Sandvig

Server ControlsServer Controls

Built in AJAX functionalityBuilt in AJAX functionality GridView, DetailsView, FormViewGridView, DetailsView, FormView

Property: AllowSortingAndPagingCallbacksProperty: AllowSortingAndPagingCallbacks

BenefitsBenefits Easy to implementEasy to implement

Limitations:Limitations: Controls cannot use templatesControls cannot use templates Inefficient: retrieves all data and discards extraInefficient: retrieves all data and discards extra

Page 12: AJAX MIS 424 MIS 424 Professor Sandvig Professor Sandvig

UpdatePanelUpdatePanel

UpdatePanelUpdatePanel Wrap any server controlsWrap any server controls Become AJAX enabledBecome AJAX enabled

BenefitsBenefits Easy to implementEasy to implement FlexibilityFlexibility

Mix & match controlsMix & match controls

Specify triggersSpecify triggers

Page 13: AJAX MIS 424 MIS 424 Professor Sandvig Professor Sandvig

Update PanelUpdate Panel

DisadvantageDisadvantage JavaScript cannot be tweakedJavaScript cannot be tweaked

Fine if it meets your needsFine if it meets your needs HeavyHeavy

All controls are repopulatedAll controls are repopulated

Viewstate also sent/receivedViewstate also sent/received

Example:Example: Cascading Dropdown:Cascading Dropdown:

AjaxAspNet.aspxAjaxAspNet.aspx

Page 14: AJAX MIS 424 MIS 424 Professor Sandvig Professor Sandvig

SummarySummary

AJAXAJAX

Use to improve user experienceUse to improve user experience Partial page refreshesPartial page refreshes

Options:Options:1.1. Code you ownCode you own

2.2. Use APIsUse APIs

3.3. ASP.NET AJAXASP.NET AJAX