只是重新加载页面内容而不是页眉或页脚? - 我需要学习使用PHP和jQuery的AJAX。 [关闭]

只是重新加载页面内容而不是页眉或页脚?  - 我需要学习使用PHP和jQuery的AJAX。  [关闭]

问题描述:

I have deigned a website and i am wanting the header and footer to stay on the page and not refresh when a page navigation link is selected on the navigation bar i just want the content to refresh.

I have header.php which contains the header and footer.php which contains the footer

at the top of each page i have <?php include("header.php"); ?> and at the bottom i have <?php include("footer.php"); ?>

these contain div tags named appropriately and my content has its own div tag called content

i have searched the internet and heard ajax could be used but nothing is coming up to how to do this, could anyone suggest any code to help or point me in the right direction

Thanks

Jack

You could learn it really quickly by using these video tutorials.
Alex makes it really simple to understand and uses PHP & jQuery to walk you through Step by Step on AJAX and everything else that goes with it.

101 - AJAX Load
102 - AJAX Send Data
103 - AJAX Callback Handlers
104 - Changing AJAX data type
105 - AJAX Status Codes

You could complete the entire 200 Part Series here to become an expert in jQuery!
Entire 200 Part Video Tutorial on jQuery

There are plenty of resources out there for learning AJAX out there. @Hary suggested w3schools and I'd second that.

This site has a good example of a site that you can navigate using AJAX.

http://javascriptsource.com/ajax/ajax-navigation.html

I'd suggest having a look at both and then coming back with some code to show if you're still stuck.

I would personally use jQuery '.get' as its a lot less code and It's easier to manipulate the data imo