jayprakash sharma

Total Post:117

Posted by  jayprakash sharma
JQuery  PHP  Mvc 
 1216  View(s)
Rate this:

this is a General Question about MVC ..

I wrote a PHP Class that send an Array with Core JsonData Strings to Jquery .. and on Jquery i´m accessing the data and add them to my views ( .append("htm stuff"+jsondata) )

now the Jquery is calling the data from a between.php page that has a catch block with many cases, and upon the called case/function , the between page is calling a function from the php class that sends the json data ..

so i have my oop php model that send the core jsondata , a controller ( catch block), and the view ( the jquery page) .. is this kind of MVC ? or i did miss understand it ?

an example of my code was posted on a previous Question here.

  1. Pravesh Singh


    Re: Example of mvc

    Looking at the code you posted in your other post it is not a MVC implementation. Or at least it is a bad implementation.

    The MVC is about seperating your presentation from your business logic. Looking at your POST class you don't seperate your business logic from your view:

    public static function readPosts(){

        $query = new Post_db("SELECT * FROM pmessage

                              ORDER BY p_id DESC



        $posts = array();

        while($row = $query->fetchRow()){

            $posts [] = new Post($row);


        foreach($posts as $item){

            echo $item;



    In this function you get information from your database (business logic) and print content (view). In other words, you combine your MV in one method. So I would say: No, this is not MVC.



Enter your email address here always to be updated. We promise not to spam!