Take the 2-minute tour ×  I am in the process of learning the
MVC pattern and building my own lightweight one in PHP  Below is
a basic example of what I have right now.  I am a little
confused on how I should handle AJAX requests/responses though.
In my example user controller below, If I went to
www.domain.com/user/friends/page-14 in the browser, it would
create a User object and call the friends method of that object
The friends method would then get the data needed for the
content portion of my page.  My app would load a template file
with a header/footer and insert the content from the object
above into the middle of the page.  Now here is where I am
confused, if a request is made using AJAX then it will call a
page that will do the process over, including loading the
template file. IF an AJAX call is made, I think it should
somehow, just return the body/content portion for my page and
not build the header/footer stuff.  So in my MVC where should I
build/load this template file which will have the heade