Submitted by BillB on 4/21/2010

(If you have a minute, please add a comment when you're done so I know if I'm presenting this well enough.)

AJAX is RESTful

AJAX isn't just about user experience; it's really about REST, though I really don't know what REST is exactly. If you don't do a full page load, the browser can be a client that maintains it's own state, just like a winforms or Silverlight app. This notion comes from an interview on .NET Rocks show 445 with Kenn Scribner. Kenn talks about how RESTful ASP.NET MVC is like it's a secret or something but MVC is outright built for it, with it's controller return type of a JsonResult; just skip the view and spit out JSON. MVC makes it so easy.

This article is a placeholder for now until I get the time to play with this idea. I thought I'd post this placeholder just because the notion bowled me over. And he's right when he says that if you're using AJAX for REST, you've got to build your app from the start with that in mind. I'm wondering what would happen if a user closes the browser and all state is lost. Just like in a fat app, you'd have to stop the user and ask, "Do you really want to leave the app? You have uncommitted changes, blah, blah." I code for that in my www.HomeDuOver.com site where I have an updateable html table but it's always scared me a bit; I don't trust it for some reason but it seems to work so far. I do this in javascript: window.onbeforeunload = preventClose;, where I ask the question. I guess timeouts wouldn't be an issue as that's a server side thing. I'll be reading Kenn's book, Effective REST Services via .NET: For .NET Framework 3.5 and go from there.

Click a star

Comments

Add your comment: