Thanks for your response, I've answered your points below:
>
>
#response.ajax = \
>> 'web2py_component("%s","patient",ajax=True,vars=vars1)' % URL
>> ('patient')
>
> I think this should be response.js rather than response.ajax.
>
This code is copied from the example 'Designing Modular Applications' on
page 94 of the web2py book. In that example it is called when a forms
'onaccept' event is triggered. In my code it is called in my 'viewPatient'
function that is called by setting the webGrid's crud_function...
(grid.crud_function = 'viewPatient'). I thought that these were similar
calls, so that response.ajax should work in the same way. Are they not the
same? ???
> Also, response.js is only used if the action that sets it is being called
> as a web2py component -- is that the case here?
>
I believe so, but I am not 100% sure. It appears that the response.ajax is
being set via a call to 'web2py_component(...)' . Is that correct?
> Finally, web2py_component() does not take an ajax or vars argument. If you
> want vars included in the URL, then pass it to the URL function.
>
The URL is pointing to a div element - (as in the example from the book).
I've tried 'URL('patient', vars=vars1)' (whilst assigning to response.ajax
and response.js) and I get a 'not all arguments converted during string
formatting' error.