does my js replace view?

Posted by Milla Well on Programmers See other posts from Programmers or by Milla Well
Published on 2012-06-21T15:06:19Z Indexed on 2012/06/21 15:23 UTC
Read the original article Hit count: 382

Filed under:
|
|

I am writing a web application which is based on Codeigniter and jQuery. I primarily use ajax to call my controller functions and it turned out, that there are just 4 view*.php files, because most of my contoller functions return JSON data, which is processed in my jQuery. So my actual code is divided in kind of MVCC model:

  • Codeigniter model (db, computations)
  • Codeigniter controller (filtering, xss-cleaning, checking permissions, call model functions)
  • jQuery controller (callback functions)
  • jQuery view (adding/removing classes, appending elements,... )

So I violate the paradigm of not using the echo function in my Codeiginter controller and simply call

echo json_encode($result);

because it doesn't make any sense to me to create a view*.php file for one loc. Especially because all the regular view*.php stuff is covered in my jQuery view. I was wondering if I am missing something out, or if there is a way to integrate this jQuery-controller in my Codeigniter. I found some words on this topic, but this seems pretty handmade. Are there some neat solutions? Does a MVCC model make sense?

© Programmers or respective owner

Related posts about mvc

Related posts about jQuery