prototype.js: Ajax.Request failing IE7 and working in FF2

Reviewing Ajax with the book 'Ajax on Rails'. At the bottom of page 24 the examples uses Ajax.request from prototype.js to replace text. It works in FF2 but fails in IE7. That's a bug I need to fix.

Here's the failing code: <p>   <a href="#" onclick="updateElement();">Update the element [Works on FF, Fails on IE7]</a> </p> <p id="responsive"></p> <script type="text/javascript">   function updateElement() {     alert("updateElement called");     new Ajax.Request('/chapter2/simpleresponse', { onSuccess: function(request) {       $('responsive').update(request.responseText);     }})   } </script>

I changed from id="response" to id="responsive" thinking I had a name conflict. No change.

I tried turning off native XMLHTTP support in the options -- no change.

Works as specified in Firefox 2.0.0.9, not in IE7.

On IE7, the alert() comes up and says "updateElement called" like it should, but the next line does nothing. Removing the alert() -- no change.

Any ideas,   Fredistic

prototype.js 1.5.0 rails 1.2.4 ruby 1.8.6

this first thing I see is that you are not stopping the link from reloading the page

try this: <a href="#" onclick="updateElement();return false">Update the element [Works on FF, Fails on IE7]</a>

instead.

Let me know if it works

Thanks