如何使用AJAX加载PHP脚本? [英] How To Load A PHP Script Using AJAX?
本文介绍了如何使用AJAX加载PHP脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道使用AJAX加载PHP页面并将其插入页面部分的最佳技术吗?
I would like to know the best technique for loading a PHP page and insert into a section of a page using AJAX?
例如,考虑以下HTML代码:
For example, consider the following HTML code:
<html>
<body>
<div id="web_Logo">
<h1>Website Logo</h1>
</div>
<div id="web_Menu">
<ul>
<li><a href="index.php">Home</a></li>
<li><a href="help.php">Help</a></li>
<li><a href="contact.php">Contact</a></li>
</ul>
</div>
<div id="web_Content">
//CONTENT LOADS HERE//
</div>
</body>
</html>
使用AJAX将页面(例如help.php或contact.php)加载到内容Div部分的最佳方法是什么?
What would be the best way to load a page (help.php or contact.php for example) using AJAX into the contents Div section?
如果有帮助,我正在为我的网站使用JQuery库.
I am using the JQuery library for my site if that helps.
推荐答案
$('#web_Content').load('myFile.php');
这篇关于如何使用AJAX加载PHP脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文