Recently I watched the following MIX conference session about konckout.js by Steve Sanderson
Even if you never have heard of knockout.js I defenitly recommend you to take a look at it, they placed a lot of effort in the documentation that is available here.
knockout is a library that can be used side by side with jQuery and other libraries but it makes your live as a web developer much easier, interested?
The documentation on the website states:
Step 2: The demo page content
This demo page is not the perfect startup example, because it combines jQuery, Rest, knockout viewmodel and knockout templates in 1 page.
In my opinion it is the combination of these 4 elements that makes it for us as SharePoint developers very interesting.
1) We use jQuery to call the REST service and when the results are returned we bind them to a helper class.
2) A viewModel is created and the helper class objects are added as an observableArray.
3) The data-bind attribute is set to a select html element, this will set the values of the observableArray as elements in the combobox.
4) The applyBindings method is called on the knockout object, this will make sure that all the values are set to the correct bindings.
The content of the sharepoint page should look like this:
The example solution can be downloaded here:
Hope this helps,