SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member GreboGuru's Avatar
    Join Date
    Jun 2006
    Location
    Wensleydale, UK
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question How to stop scroll jump when sending XMLHttpRequest

    Hi,

    I've a very simple AJAX implementation to update a list of favourites from a set of search results. How do I stop the page from scrolling to the top of the page when performing the favourites update? Upon return from the update I simply display a message, so I'm not changing the structure of the page.

    I'm sure this is trivial ...

    Thanks in advance

    Scott

  2. #2
    SitePoint Enthusiast
    Join Date
    Nov 2005
    Location
    London, UK
    Posts
    81
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Let me guess, you have code that looks like this:
    Code:
    <a href="#" onclick="updateWithAjax()">update</a>
    Replace that with
    Code:
    <a href="#" onclick="updateWithAjax(); return false">update</a>

  3. #3
    SitePoint Member GreboGuru's Avatar
    Join Date
    Jun 2006
    Location
    Wensleydale, UK
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ahhhhhhhh now I see .... works a treat.
    Thanks!


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
  •