Hi-
I''m trying to implement an auto-complete using Yahoo''s
autocomplete
server, which basically suggests search completions:
http://ff.search.yahoo.com/gossip?output=fxjson&command={your
searchterms}''
if you want to see the results in your browser, use xml instead:
http://ff.search.yahoo.com/gossip?output=xml&command={your
searchterms}''
So, I can type this into a browser directly and it works just fine,
but when i try to use it with observe_field, it fails, i always get a
result back of empty string.
Am I violating some rule about cross-site ajax calls? Can I have my
server generate the observe_field code which calls a 3rd party server
for ajax updates, like observe_field?
Here''s my code:
<%=observe_field "query_box",
:frequency => 0.5,
:url => "http://ff.search.yahoo.com/gossip",
:method => "GET",
:with => "''output=fxjson&command={'' +
encodeURIComponent(value) + ''}''",
#:with => "",
:complete => "process(request);"
#:complete => "alert(request.responseText);"
%>
the function gets called just fine, and you can even copy and paste
the request url using firebug into a browser URL box and it works just
fine, but this always returns an empty string in the Ajax call.
So, is this fundamentally not possible, or am I doing something wrong?
Thanks for any help.
Dino
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung
2010-Feb-08 20:33 UTC
Re: can use use observe_field with a 3rd party server?
On Feb 8, 5:19 pm, "dino d." <dinodorr...-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote:> Am I violating some rule about cross-site ajax calls? Can I have my > server generate the observe_field code which calls a 3rd party server > for ajax updates, like observe_field?The javascript that observe_field generates will mean that you break the rules about cross site ajax calls. The yahoo developer network has a page ( http://developer.yahoo.com/javascript/howto-proxy.html ) on this and various ways of tackling this. Fred -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.