user240993
user240993

Reputation:

Using MVC in Javascript without any server-side language?

I'm in the process of trying to wrap my head around using MVC and using it with javascript. I'll be making a mobile app with HTML5 and don't plan to use any server side languages only local storage.

How can this be achieved? I'm usually thrown off by the model since it relies on the back end language from my understanding.

Upvotes: 1

Views: 574

Answers (3)

Kirstein
Kirstein

Reputation: 893

There are multiple MV* frameworks available. You don't have to have server support to use them.

There are many more, but these three come to mind first. Enjoy

Upvotes: 3

GillesC
GillesC

Reputation: 10874

MVC development has nothing to do with server side scripting.

It only relate to the type of architecture you are taking to develop your application.

It only means you have Models, Views and Controllers. Models can be object generated from javascript which are used with the Views in order to render some data.

Controllers are there to hold the logic and behaviour between the view and the models.

Well that's a very basic overview, but by no means does MVC means backend services or ajax calls.

This article might help http://www.alexatnet.com/articles/model-view-controller-mvc-javascript

Upvotes: 0

Madara's Ghost
Madara's Ghost

Reputation: 174967

The Model doesn't rely on the back end. MVC in conceptually simple:

  1. Controller gets request.
  2. Controller calls for Model to do all of the logic (be it database interaction, localStorage interaction of whatever)
  3. Model returns data to Controller.
  4. Controller calls View accordingly, and if needed, passes data from the Model.

This means, that Model doesn't have to use a server side language, it's a placeholder for the application logic.

Upvotes: 3

Related Questions