如何使用Jquery包含php文件? [英] How to include php file using Jquery?

查看:122
本文介绍了如何使用Jquery包含php文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有那个div:

<div id="content"></div>

并且我想使用jQuery将其包含在PHP文件中.

and I want to include inside PHP file using jQuery.

我尝试了一下,但是不起作用:

I try with this, but doesn't work:

var about_me = "<?php include('php/about_me.php') ?>"

$('$content').click(function(){
 $('#content').text(about_me);
});

这会给我像字符串一样的PHP代码吗?

This returns me PHP code like a string?

推荐答案

您可以使用 .load :

You could use .load:

$("#content").load('/about_me.php');

这篇关于如何使用Jquery包含php文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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