Wordpress Themes - Kamala Harris - Debt Consolidation - WoW Gold - Find jobs

PDA

View Full Version : Ajax causes the page to reload...?


jkashu
Dec 14th 2008, 7:55 pm
I am using a simple function (like this: http://www.ajaxlines.com/ajax/stuff/article/simple_ajax_javascript_function.php) to make ajax calls; however, the page still reloads...

I call this function with an onclick event on a hyperlink.

Thoughts? Why would the page reload?

lp1051
Dec 15th 2008, 2:48 am
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
}