Wrapping MVC in PHP and Javascript