Okay, that means that 'this' inside the Ajax.Updater is not set to what you think it is. Try this:
function get_word(elm)
{
new Ajax.Updater
(
'output',
'mylist.php',
{
method: 'get',
parameters: { word: $(elm).readAttribute("id") }
}
);
}
call it with get_word(this) in your inline handler example.
A much neater way to handle this is with an unobtrusive handler. For this HTML (note the differences):
<div><p class='textword' id='myword1'>myword1</p>
<p class='textword' id='myword2'>myword2</p></div>
<div id="output">[Results appear here.]</div>
could be handled with this JavaScript:
<script type="text/javascript">
document.observe('dom:loaded', function(){
document.on('click','.textword', function(evt, elm){
new Ajax.Updater(
'output',
'mylist.php', {
method: 'get',
parameters: {
word: elm.readAttribute('id')
}
}
);
});
});
</script>
Much cleaner and fewer global variables are massacred.
Walter
On Oct 28, 2012, at 3:23 PM, donnek wrote:
>
>
> On Sunday, 28 October 2012 15:53:37 UTC, Walter Lee Davis wrote:
> What does Firebug say your request looks like? What does your server respond with?
>
> TypeError: $(this).readAttribute is not a function
>
> parameters: { word: $(this).readAttribute("id") }
>
> There's no change to the calling page - it shows nothing in the "output" div.
>
> --
> You received this message because you are subscribed to the Google Groups "Prototype &
script.aculo.us" group.
> To view this discussion on the web visit
https://groups.google.com/d/msg/prototype-scriptaculous/-/23HHumtY6uYJ.