views:

105

answers:

2

I think about AJAX in this way:

  • Model: The server-side where the data is stored and exposed through webservices. In a way this is a model-view-controller within the larger model-view-controller (model = data, view = XML or some other parsable data structure, controller = server-side code that manipulates the data).
  • View: XHTML/DOM
  • Controller: Javascript/JQuery

Is this a reasonable way to think about AJAX programming?

+1  A: 

I've been finding it more useful to design ajax code around an event based paradigm. MVC is not mutually exclusive to event based organization but the focus for me has been more and more on the event handling side of things and less on the traditional model view controller way of looking at things.

It's more of a MWE (Model, Widget, Event) organization with the event code taking the place or wrapping the Controller code.

Jeremy Wall
+2  A: 

You too, huh?

Yes. I think this is a very good way to structure edit operations.

However... You probably want to keep to traditional HTML "view" pages for many documents or objects within an application so that you can support search engines if need be, and so that deep links into pages in your application come up with something meaningful.

This way, using both approaches, you have a hybrid, rather than the "un-webby rectangle" problem where you can never bookmark anything, send links to your friends, or have search engines generate [good] links.


8/10: I guess this also means that you should think of the "server" side of your application as a "REST" service, ideally. Also, be sure not to fall into the trap of thinking the client code is in any way, whatsoever, secure (or even "obscure", for that matter). Make sure the supporting "service calls" back to your web server have a good security infrastructure.

Roboprog