使用Smarty在AJAX中加载php页面

I'm looking to load my site pages using AJAX, therefore saving on loading the header and footer every time and just changing the content.

How would I go about doing this as I am using smarty?

I'm aware that this may be the order it needs to go in:

--

Request PHP

parse TPL

make html

show in browser

--

I'm just not sure how to actually go about doing the second and third steps particularly.

Do what you would normally do.

For AJAX: Call some javascript function, retrieve to-show data, show data in some DOM location

For php/smarty: recieve request (from ajax, but who cares), do PHP stuff, fill smarty vars, call smarty show, return to-show data.

You can do it in two ways :

Call a jquery ajax function that change contents of div.

second :

Use iframe where you want change content.