Welcome Guest, Not a member yet? Register   Sign In
Controller ajax request
#4

The idea behind MVC is that you separate the various components of your application so they can operate on a "need to know" basis.

Your models should be concerned with data, like say, a "Customer" record. A database should not give two shits about the type of <div> the customer's first name is going to be wrapped in. (Side note: Seeing HTML in a DB table is one of those things that is just wrong.)

Controllers do the dispatch to the models, and extract relevant data from the models, and forward it out to your Views.

A View takes some set of expected data and transforms it into a something that would make sense in the context of the view. If you're sending a confirmation email, you might forward to an "Email" view with data like "email address" and "message body".

'm in the middle of a web development learning project. I'm working on implementing the MVC pattern using PHP+Smarty templates for the "framework." So far, I have implemented the basics of the app (base classes for models, views, and controllers as well as test cases for each and example db queries etc.), and am planning to integrate JavaScript (+jQuery) and AJAX to submit things like comments and feedback so I don't have to redirect the user anywhere.

Thus far, MVC has been a dream. Aside from learning the basics, I never really jumped on the Rails bandwagon but I wholly appreciate the clean and separated approach to development (my education is in C programming).

My question is where/how should I integrate ajax support into my framework? My file structure looks like:

app

controllers

helpers

models

views

config

include

basecontroller.php

basemodel.php

baseview.php
Reply


Messages In This Thread
Controller ajax request - by jameslatajan1233 - 07-25-2022, 08:39 PM
RE: Controller ajax request - by includebeer - 07-26-2022, 06:24 AM
RE: Controller ajax request - by ozornick - 09-23-2022, 06:29 AM
RE: Controller ajax request - by HumeleJotesane - 09-26-2022, 03:34 AM
RE: Controller ajax request - by MatrickEganlan - 11-13-2022, 08:58 PM
RE: Controller ajax request - by InsiteFX - 11-13-2022, 11:29 PM



Theme © iAndrew 2016 - Forum software by © MyBB