Suggestion of how to create a javascript class -
i have java app architecture: entity + persistence + business + rest services.
i want create view layer without jsf, in other words, want use html + css + js (jquery + ajax).
what better way create javascript class access rest services?
var bookmark = function() { this.id; this.description; this.link; }; bookmark.prototype._insert = function() { // here should put jquery ajax call? }; bookmark.prototype._delete = function() { // here should put jquery ajax call? } bookmark.prototype._update = function() { // here should put jquery ajax call? } bookmark.prototype._findbyid = function() { // here should put jquery ajax call? } bookmark.prototype._findbyid = function() { // here should put jquery ajax call? }
the above format acceptable?
what have ok. problem might encounter if interaction server not fall realm of 1 model object, model layer going messy.
why not on server, , create service layer?
app.api = { login: function(onsuccess) {....} findbook: function(id, onsuccess) {....} }
Comments
Post a Comment