Ajax architecture - MVC? Others?

Hey there, I’m looking at creating an ajax-heavy website, and I'm trying to spend some time thinking preliminary through architecture.

I am using Code Igniter and jquery. My initial thought process was to figure out how to replicate MVC on the javascript side, but it seems that M and C do not really have much space.

Many JSs will be ajax calls, but I can see that this is growing for it, with a lot of DOM manipulation, as well as finding an HTML5 client database. How do I think about the architecture of these files? Does it make sense to chase MVC? Do I have to somehow go according to the jquery plugin plan? I'm lost on how to proceed and I will like the tips. Thanks everyone!

+5
source share
5 answers

I created a javascript program in MVC style. Included with M and C. Perhaps I made the wrong move, but I ended up creating my own event dispatcher library. I made sure that different levels only bind the message protocol, which can be translated into pure JSON objects (although I actually do not do this translation step).

jQuery V- MVC. M C , , , CLI spidermonkey JavaScript- JavaScript-, . , , M C , json V . . , , , , , .

. , , , , , , . - . . , , , .

, , , - . , , , " ". javascript flapjax. , , flapjax. ( , flapjax , ).

- , ( Mac). , . ( javascript, )

, , - , , . , " " " ", " , , , , ". , .

, , , . , , , , .

, . , .

+9

, JQuery, . ala-mode , M, V C.

Dojo -, , . , , - MVC. .

Dojo , JQuery.

AJAX ( ), , . CSS . , .

, . , " " /-.

+6

JavaScriptMVC (javascriptmvc.com) - JS .

. 4 , - JavaScript:

  • / (Ajax)
  • ajax.
  • DOM

JMVC Model, View, Controller.

-, , , . , . . , , , '#todos', , todos.

$.Controller.extend('TodosController',{
   'click' : function(el, ev){ ... },
   '.delete mouseover': function(el, ev){ ...}
   '.drag draginit' : function(el, ev, drag){ ...}
})

. JMVC , Ajax (# 2) (№ 3). , :

Todo.findAll({after: new Date()}, myCallbackFunction);

, todos , (# 4). JMVC-.

'.show click' : function(el, ev){ 
   Todo.findAll({after: new Date()}, this.callback('list'));
},
list : function(todos){
   $('#todos').html( this.view(todos));
}

'views/todos/list.ejs'

<% for(var i =0; i < this.length; i++){ %>
   <label><%= this[i].description %></label>
<%}%>

JMVC , . :

  • ,
  • Script
+4

, JavaScript "" "".

AngularJS.

"" "". , jQuery.

(, e2e) + , AngularJS.

+3

JavaScript MVC, : http://javascriptmvc.com/

+1

All Articles