Ajax causes the page to reload...?

Discussion in 'JavaScript' started by jkashu, Dec 14, 2008.

  1. #1
    jkashu, Dec 14, 2008 IP
  2. lp1051

    lp1051 Well-Known Member

    Messages:
    163
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    108
    #2
    Hi, better would be to post your own code. If you have some syntax error, following solution won't help you. But if you use onclick event, consider to use calling your function with return and inside your function call return false. Due to this, you won't let the browser continue on href destination.
    E.g.
    <a href="#" onclick="return my_func()">Run</a>
    function my_func() {
    ... something with ajax
    return false
    }
     
    lp1051, Dec 15, 2008 IP