Hello, We have added a "recently viewed items" panel to the right side of our website. In this panel we simply loop through the array of viewed items and present them with a picture and a link stacked up in the panel.

The code for rendering the list of items is in a separate ColdFusion template that is placed within a DIV tag using an Ajax call. The problem is that the javascript is not executing in the recently viewed items panel for each of the individual items. For instance:

<script type="text/javascript"> var pr_page_id="#currItem#"; snippet(document); </script>

This code is in the loop so that each iteration of an item should show the "starSnippet." I can't see the javascript in the source code since it's inside a <DIV> but the non-Ajax (CF) parts of the page that use the same technique are getting the correct snippet so I know that the code works and that the problem must come from the use of the Ajax call.

Any ideas on a different way to call this so it will fire the javascripts correctly.

Thanks much,
Vibeman

Nailing down the problem would be very difficult given that we can't reproduce the scenario here. Maybe looking into something along the lines of a Javascript debugger which helps you step thru your application and at the same time show the HTML markup which was dynamically rendered might work out for you. Look for Firebug, a Firefox addon for the above mentioned features; it might just help you out.

Thanks for the advice. I'm already using Firebug and what I know is that the javascripts in the Recently Viewed Items panel just don't execute. If I view the panel apart from the rest of the page then all javascripts fire and I see the review stars correctly.

I can see that the same javascripts in the main content area of the site are firing and that they are working correctly but the ones in the Recently Viewed panel do not reload. I read on another post that the Ajax panel just changes state upon reloading the page and that the "page" that is seen in the ajax panel doesn't actually make a request to the web server so the javascripts don't execute.

This doesn't make sense to me for our situation since the most recently viewed item has just been added to the panel. Thus, the CF template has been through it's loop to add the item to the existing array.

I tried adding an onload="myJavascript" attribute to the image tag thinking that when the image loaded it could execute the javascript each time it showed the image for the recently viewed item but that doesn't seem to work either.

Regards,
Jerry

This article has been dead for over six months. Start a new discussion instead.