如何通过jQuery的加载PHP文件到DIV? [英] How to load PHP file into DIV by jQuery?

查看:399
本文介绍了如何通过jQuery的加载PHP文件到DIV?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个网站,我有这个侧面菜单上的:

I am developing a website and I have this on the side menu :

< A HREF =#级=leftMenuID =接触与GT;联系我们< / A>

然后,我有这个剧本

$(document).ready(function(){
  $("#contact").click(function(){
    $("#contents").load('home.php');
  });
});

和我有这个DIV在我的网页:

and I have this DIV inside my page :

< D​​IV CLASS =contentWrapperID =内容>< / DIV>

很显然,我所要做的是加载home.php当我点击联系我们的超链接,这是行不通的。什么是错我的code?

Obviously, what I am trying to do is to load home.php when I click on the Contact Us hyperlink, which doesn't work. What is wrong with my code?

推荐答案

补充,而不是文件名 home.php 页面的URL。

add home.php page url instead of file name.

$(document).ready(function(){
  $("#contact").click(function(){
    $("#contents").load('url to home.php');
  });
});

这篇关于如何通过jQuery的加载PHP文件到DIV?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆