Goal: I want to click a link and have the html returned by the resulting ajax call loaded into a div.
I’ve made a link using the JsHelper like so:
<?php echo $this->Js->link('Do some ajax!', array(
'controller' => 'items',
'action' => 'view',
1
), array('update' => '#item'));?>
but instead of following through on the ajax request, the link is followed.
In jQuery the default event of the link could be repressed using event.preventDefault() but I can find no obvious way to tell the JsHelper to do this.
Question: How can I prevent the default event of the link? Alternatively; should I really not be using a link at all? If so, what should I be using?
So the reason the link was followed was really stupid. I hadn’t included jQuery properly… There is no way to save face here. :/ Many thanks to Jared for trying to help me though!