Currently, I am using this jQuery code to put HTML from another file into a content div
$("#list li a").click(function(){
var id = this.id;
$('#content').fadeOut('fast', function(){
$.ajax({url:"./html/" + id + ".html",success:function(result){
$("#content").html(result);
}});
});
$('#content').fadeIn('fast');
});
It is pulling the ID from the anchor tags from this list
<ul id='list'>
<li><a href="#" class="nav" id="home">Home</a></li>
<li><a href="#" class="nav" id="order">Order Form</a></li>
</ul>
The database would have a table named 'content' with column named 'html' which contains the actual HTML code that needs to be loaded into the div.
How do I use the ID in the anchor tag to get the corresponding row with the HTML code, and display it in the content div?
EDIT: So, I figured out that this would be my query:
$result = mysqli_query($con,"SELECT content FROM htmlcontent WHERE id='' ");
My question now is, how to I pass the ID from the ajax call in the html page to the php function, and how do I return the $result and display it in the #content div?