JavaScript MVC jQuery Plugin + JavaScript MVC Framework

Download sample project (netflix movie browser) or check out this (updated) Demo.

Download here is another demo build on Google Analytics gdata API.

About

This the purpose of this example is to show how to build JavaScript rich internet application in the MVC pattern. Views, controllers and models are all in separate files. No server is required to run this project. No page based specific logic is being preloaded. Like in server-based MVC apps, this app is stateles, with the back button support. Since this runs as single page app (like gmail), the performance compared to classic web page based apps is 100x +. This demo is a really in alpha mode, so please feel free to let me know of any bugs you find.

Features:

  • On-demand controller loading
  • On-demand view loading
  • ASP.NET MVC-like routing syntax and code structure
  • Restful URLs, example: /Movie/Index/Cartoons/2/5
  • No server required
  • Fast
  • Scalable

Usage:

$("#content").MVC({
  routes: [
    {
      name: "Test1", // Name
      path: "bar/{controller}/{action}/{p1}/{p3}/{p2}", // Path.
      params: { controller: "One", action: "Index", p1: "1", p2: "1", p3: "1"} // Defaults.
    },
    {
      name: "Default", // Name
      path: "{controller}/{action}/{p1}/{p3}/{p2}", // Path.
      params: { controller: "One", action: "Index", p1: "1", p2: "1", p3: "1"} // Defaults.
    }
  ]
});

Credits:

This plugin uses jQuery and the jQuery-tmpl plugin as its view engine.