try this:
<html>
<head>
<script>
       function remove()
      {
      var a = document.getElementById('id');
      var b = (a.parentNode).removeChild(a);
      }
      function add(x,y){
        alert(x+y);
        return x+y;
        }
</script>
</head>
<body>
<span id="id">text</span>
<br />
<input type="button" value="Remove text" onclick="remove();" />
<a href="" onclick="add(2,3); return false;">2+3?</a>
</body>
</html>

now try removing "return false" after add function.
the thing is, if function returnes value, page will be reloaded.
If functions does not have a return value, it will not reload the page.
But using "return false" always won't hurt ;)

p.s. you can see if it is reloaded if you remove text and click 2+3?.
if text is back, it is reloaded.

On Fri, Dec 24, 2010 at 9:52 PM, weheh <richard_gor...@verizon.net> wrote:

> I use onclick="ajax(...);" in lots of places without the return false
> and never have observed the page getting reloaded on either firefox or
> chrome.
>
> On Dec 24, 1:37 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> > only
> >
> > <a onclick=".....; return false;">...</a>
> >
> > else the page is reloaded no matter what the ..... do.
> >
> > On Dec 24, 11:26 am, weheh <richard_gor...@verizon.net> wrote:
> >
> > > Should one's view *always* have a return false; statement immediately
> > > after an ajax request? Why?
> >
> >
>

Reply via email to