SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Wizard
    Join Date
    Dec 2005
    Posts
    1,718
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Stop Ajax reseting my jQuery code

    Hi all

    I had a thread a few days back. Resolved.
    Example snippet shown below which triggers when my page ID is #listings:

    Code JavaScript:
    if ($("#listings")[0]){
      $('.placeholder').before('<div class="napp"><img src="images/napp.png"></div>');
    }

    This works great, the problem now is that I have some ajax running which when I click the next link/button to show other photos, content etc. this resets the above and moves my <div class="napp"> back to hidden again. Even though the address bar doesn't change or refresh my jquery code should stay in place. But ajax resets all my nodes within the dom.

    My question.
    How do I stop this?
    Is it something to do with CALL, TRIGGER?

    What do you suggest?

    Thanks,
    Barry
    The more you learn.... the more you learn there is more to learn.

  2. #2
    SitePoint Wizard
    Join Date
    Dec 2005
    Posts
    1,718
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For the record I'm still somewhat a Javascript, jQuery novice and the Ajax in discussion is already running on the page added by other developers. I've added the jquery snippets above manually.

    Any feedback, guidance on this issue is much appreciated.
    The more you learn.... the more you learn there is more to learn.

  3. #3
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,941
    Mentioned
    215 Post(s)
    Tagged
    12 Thread(s)
    Hi Barry,

    Do you have a link to a page where I can see this?


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
  •