Log in

View Full Version : $.ajax with jquery isn't working on my site



slashafk
07-30-2012, 07:11 PM
I'm trying to create a "scrolling pagination" (similar to Facebook) except users have to click to load more content.

This is my javascript function. I'm using Jquery.


function GetMore(){
$.ajax({
url: 'phpfile_that_echos_content.php',
success: function(data){
$('#content').append(data);
}
});
}

The php file gets queries from the database and formats the information based on what type of content it is. The php file works without the ajax call.

I call it using a clickable image...

<a href="javascript: GetMore()">
<img src="image.png" />
</a>

However, when I click the image, it does not show. When I append data to the content div without using $.ajax, it works. My site is hosted on Godaddy with a Linux server and I'm using PHP. Does anyone know why my code isn't working?

jscheuer1
07-30-2012, 08:05 PM
There are virtually an infinite number of possibilities as to why this might not work. To have the best chance of figuring it out, we need a link to the page.

Please post a link to the page on your site that contains the problematic code so we can check it out.