Reputation: 489
I have that div:
<div id="content"></div>
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);
});
This returns me PHP code like a string?
Upvotes: 5
Views: 30188
Reputation: 210
this is a simple way that you can do it. Just do it.
just put the file name in .load function
$(function(){ $("#includedContent").load("header.php"); });
Upvotes: 0
Reputation: 5975
Is it a .php file? IF it's a .js or .html file, Apache (or whatever webserver you're using) won't interpret it as a PHP file and won't include the relevant file.
Upvotes: 2