views:

393

answers:

3

I'm working on a web app which is heavy on the client side, which is a first for me. I'm also using jQuery for the first time. I need to have my client-side code keep track of model data which it fetches via Ajax calls.

What's a good way to store this data? Does jQuery provide a good solution, or is there a good generic Javascript solution? I basically want to write model classes in Javascript, (but I don't necessarily need inheritance). Right now my jQuery code is a controller layer, and the DOM and CSS form my view layer. How do other people accomplish a model layer?

+4  A: 

jQuery developer Adam Wulf released a series of tutorials covering his development of MVC patterns on the client with jQuery some time back. You may find them to be very helpful in your current project. Also, JollyToad did some work in this area as well. You can view their results online too.

Jonathan Sampson
Brilliant! Thank you!
Peeja
A: 

I typically use server-built JSON data structures to hold all the stuff my client-side is going to use for interactive manipulations, etc. Nothing specific to jQuery about that...

Scott Evernden
+1  A: 

There is also, I've discovered, a technique known as Concrete Javascript, where the DOM objects are used as model objects. Effen sounds like a nice way to implement that: http://github.com/nkallen/effen/tree/master.

Peeja