I have a list of nodes each with a click. The click sends a node reference argument which loads a new view using ajax. Jquery collects the node reference number via a hidden input value on the content-type-tpl.php. Likewise the nodes in the new view each have a click which sends a node reference argument which loads a new view using ajax. However while the clicks in the original view work correctly the clicks in the newly called view do not reference the correct node. Instead of referencing the node id for the node which is clicked, the node id of the next node in the view is collected instead. Oddly when placing `<?php echo $node->nid;?>` on the content-type-tpl.php the correct node id is echoed on the page but sadly this is not the one sent to the view argument. So clicking any node in the the newly loaded ajaxed view sends the id for the next node. Here's the javacript: Drupal.behaviors.ajaxlinks = function (context) { $('.morelink:not(.togg-processed)', context).addClass('togg-processed').each(function () { $index = $('.morelink').index($(this)); var target = $('.newthing').eq($('.morelink').index($(this))) var nid = $(".mynid").eq($index).val(); $(this).click(function() { if (($('.hiddenrows').eq($('.morelink').index($(this))).is(":hidden")) || ($('.shownrows').eq($('.morelink').index($(this))).is(":visible"))) { $('.hiddenrows').eq($('.morelink').index($(this))).show(); $('.newthing').eq($('.morelink').index($(this))).show(); var toLoad = Drupal.settings.basePath + 'replies/' + nid; xhr = $.ajax({ url: toLoad, success: function(data) { $(target).css( "height","200px" ); $(target).html($(data)); Drupal.attachBehaviors(context); } }); } else { $('.hiddenrows').eq($('.morelink').index($(this))).hide(); $('.newthing').eq($('.morelink').index($(this))).hide(); } return false; }); }); }; And here is the php which shows in the content-type.tpl.php for both views: <div class="newthing" > <input type="hidden" class="mynid" value=<?php echo $node->nid;?> /> </div> <!-- newthing --> Can anyone spot what I am doing wrong?