Ian Collins wrote:
I prefer JSON for AJAX applications.
I'm trying to use the Yahoo! UI connection library with a Rails server
application. It is very natural for a Rails app to return html string
so I want to try to get this combination working.
Have you tried sending back a file name, creating a script element,
setting the type (text/javascript) and src (file name) attributes?
I don't think that will work so well in this situation because the
Rails app is dynamically creating the response. I'd have to save that
to disk first. Besides, shouldn't the following work anyway?
I tried to find the script strings in the AJAX response text with the
following. "o" is the variable holding the ajax response object that
Yahoo connection lib supplies. o.responseText is the string
representing the response. This doesn't seem to find any scripts even
thought I know a script is in the string.
var spt = o.responseText.match(/<.*?script.*?>.*?<\/.*?script.*>/gm);
This regular expression works in a little test Ruby script I tried.
Any ideas?
Thanks,
Peter
The Yahoo lib also has o.responseXML which is a DOM fragment as far as
I know. Using this doesn't work for me either.