Views 3 (D7) Attaching custom markup to individual view results Ok so a bit of background first on why I want to do this, this may also spark someone to suggest a better way of doing this also. I'm always open to ideas!

Basically I have a bunch of content types, call them rooms for the moment.
I am using views to sort/search these rooms, works great (as expected with views).

Now what I want is to attach some php and an jquery script to each view result itself, this script will get an ID from a field attached to the view result, this will then be sent as an ajax request get some information and then come back with some results which will then be printed underneath the view result. 

How do I go about doing this? I've taken a look at a few of the different hooks available for the views api but can't really figure out which one is the one I want. 

Any suggestions are greatly appreciated. Dan
Try hook_views_pre_render() see docs and drupal_add_js().


Add the correct JS using drupal_add_js by injecting the JS file using hook_views_pre_render() to fire on the correct view.
Your JS will have to understand the default views output to re-theme / alter HTML output accordingly. Firebug or Chrome Developer tools can help you with that.
you can use $view-&gt;attachment_after to attach like a custom blob of HTML like &lt;div id="mycustom_content"&gt;&lt;/div&gt; so you can muck with this div on your Ajax callback. You can add the view attachment in the view_pre_render