SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Wizard silver trophy TheOriginalH's Avatar
    Join Date
    Aug 2000
    Location
    Thailand
    Posts
    4,810
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    jQuery issue - href changing

    I have the following code:
    PHP Code:
    $(".loader").click(function () {
    var 
    newHref = $(this).attr("href") + "&js"
    $(
    "#loadcontent").load(newHref);
    return 
    false;}); 
    What is does is append "&js" to any link. All hrefs point to content.php, which first builds the section "loadcontent" (the content area of the page), then either returns a full page if the "&js" parameter isn't passed to it, or just the "loadcontent" div if it is. This works perfectly on the first load. The "loadcontent" div now contains links created by the load function. Clicking these links however does NOT seem to append "&js" (even though they do carry the .loader class", and I get a full page refresh Any idea how to solve this?
    ~The Artist Latterly Known as Crazy Hamster~
    922ee590a26bd62eb9b33cf2877a00df
    Currently delving into Django, GIT & CentOS

  2. #2
    SitePoint Wizard silver trophy TheOriginalH's Avatar
    Join Date
    Aug 2000
    Location
    Thailand
    Posts
    4,810
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Argh, realised why this is happening! The loaded content hasn't had the event listener attached to the .loader clasess. Bugger - how would I get around that?

    ps: in php tags because the code tags seem to be doing screwy things for me


    Edit:


    Problem solved with LiveQuery
    Last edited by TheOriginalH; Mar 17, 2008 at 05:45.
    ~The Artist Latterly Known as Crazy Hamster~
    922ee590a26bd62eb9b33cf2877a00df
    Currently delving into Django, GIT & CentOS


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
  •