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

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -