I have a set of ids being generated in a foreach loop
<?php foreach ($_Collection as $_item): ?>
<img class="<?php echo $_product->getId() ?>" src="<?php echo Mage::helper('catalog/image')->init($_product, 'small_image')->resize(100, 75); ?>" />
I want to be able to grab specific divs with ajax by using the class that is generated as it will match both in this and the target document. So I was hoping to try something like this in the same foreach loop :
$(document).ready(function() {
var item = "<?php echo $_product->getId() ?>";
$('img .'+item).click(function (){
$('#result').load('ajax-page .'+item+')
})
This is just for an example but I am sure there are multiple things wrong. For one what is printed looks like ...
var item = "156294";
$j('img .'+item).click(function (){
$j('#result').load('ajax-page .item')
});
For starters... how can I pass the item variable to the selector from within this loop?