MVVM can work well on the Internet and in XAML-based technology. XAML tech has the edge in its amazing baked functions that are baked. But with JavaScript libraries such as Knockout (which is great) and JsViews / JsRender (which you should see as soon as JsViews becomes beta).
To answer you specifically: yes, you can do MVVM using web applications. It's good? Yes, if you use a library like Knockout (http://knockoutjs.com). The key to MVVM is that it is a simple partitioning template that:
- shares view (page)
- separates the model (source data)
- shared viewmodel (presentation logic)
Nowhere is the technology prescribed by MVVM. View is your html, your structure. The model is your data (possibly JSON). Viewmodel is your javascript object that separates the logic of your particular view.
A knockout provides a means to bind data to money through a concept that he calls observable. basically think of it as the INotifyPropertyChanged interface, but for JavaScript. Knockout also supports an observable array (which is similar to an ObservableCollection in XAML). The knockout has many other features that allow you to subscribe to data change events, create behavior, customize bindings and much more. Anyway ... with Knockout you get quite a bit.
If you choose MVVM without a library such as Knockout, you can still do it, but you will lose the data binding functions and probably want to write something yourself. But I highly recommend sticking with a library that does this for you.
The long answer ... but I wanted to give you enough to start studying.
John papa
source share