SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jul 2012
    Location
    Fairfax, Virginia, United States
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    $.ajax (jquery) isn't working on my site

    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.
    //Start Code
    function GetMore(){
    $.ajax({
    url: 'phpfile_that_echos_content.php',
    success: function(data){
    $('#content').append(data);
    }
    });
    }
    //End Code
    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?

  2. #2
    SitePoint Zealot
    Join Date
    May 2008
    Posts
    112
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do you use firebug to look at javascript errors? If not I would highly advise look into that...

    Could be the path to your file is not correct?
    renkai.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •