Can use use observe_field with a 3rd party server?

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

On Feb 8, 5:19 pm, “dino d.” [email protected] 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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs