[eluser]alboyd[/eluser]
Lol well i'm not sure. But I gather you mean how to pass data from the anchor to jquery not from controller to jquery...
So the way I have done it a lot is using class and id lol.. probably quite bad but hell it works!
for example:
Code:
<a href="#" id="view_item" class="item_<?php echo $item_id;?>">Item <?php echo $item_name;?></a>
Then in JQuery:
Code:
$("a#view_item").click(function() {
var item_id_str = $(this).attr("class");
// post it to controller as item_id_str : item_id_str
});
You could also use title I guess. I don't think anyone else on this forum is bothering reading this thread - but if they are I would be interested to see how other people do it!
In controller if I need the ID that has been passed through (item_10):
Code:
$item_id_str = $this->input->post('item_id_str');
list($blah, $item_id) = split('_', $item_id_str);
// Do stuff with your new $item_id value.... :)
EDIT: In most cases it will be the other way around - you will have a list of anchors with id's and therefore the class should be used for the click trigger ie; class = "view_item" and the ID should be the item_id