Reputation: 967
(I am pretty new to all this.) I have a page where the user can click between different sorting methods of user posts. Depending on which they click the content shown will correspond.
function newContent()
{
$.ajax({
url: 'ajax/newcontent.php',
success: function()
{
$("#content_div").empty().load("ajax/newcontent.php");
}
});
}
This is what I have now. But instead of loading the code from the .php page into the #content_box, the #content_box just goes blank.
Any help would be awesome!
EDIT ** changed #content_dov to #content_div - whoops
Upvotes: 2
Views: 10808
Reputation: 20654
Why are you using two ajax requests? You just need to use
$("#content_dov").load("ajax/newcontent.php");
The full code is
function newContent()
{
$("#content_dov").load("ajax/newcontent.php");
}
Upvotes: 5
Reputation: 35572
function newContent()
{
$.ajax({
url: 'ajax/newcontent.php',
success: function(data)
{
$("#content_dov").html(data);
}
});
}
Upvotes: 3