atom feed7 messages in com.googlegroups.google-ajax-search-apiRe: Is there any method to lock until...
FromSent OnAttachments
EurekaSep 15, 2010 6:49 pm 
Jeremy GeerdesSep 15, 2010 7:08 pm 
EurekaSep 16, 2010 1:41 pm 
Jeremy GeerdesSep 16, 2010 1:45 pm 
EurekaSep 16, 2010 2:26 pm 
EurekaSep 16, 2010 5:31 pm 
Jeremy GeerdesSep 16, 2010 7:54 pm 
Subject:Re: Is there any method to lock until i get an answer?
From:Eureka (luca@gmail.com)
Date:Sep 16, 2010 1:41:27 pm
List:com.googlegroups.google-ajax-search-api

Bufff I think I'm gonna try to do some way different. I don't know very well js. If google API were accessible from PHP may be it would be easier.

Thanks for your comment!

On Sep 16, 4:08 am, Jeremy Geerdes <jrge@gmail.com> wrote:

Using Javascript alone, there is really no way to run translation requests
"synchronously," or in such a manner that the browser runs the translation and
waits to continue executing script until a response is received. That said, you
can work around this by building your own server-side proxy. Once you've built
this proxy, you can set up an XMLHttpRequest in synchronous mode to send
requests back to the server, which will send the request to Google and return
the response back to your script. You will then have to parse it with either an
eval (not a great idea) or the json2.js parser fromhttp://www.json.org.

Jeremy R. Geerdes Effective website design & development Des Moines, IA

For more information or a project quote:http://jgeerdes.home.mchsi.com jrge@gmail.com

If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan Church!

On Sep 15, 2010, at 8:49 PM, Eureka wrote:

Hi!

i'm making a js script for retranslating some times an array. It's quite funny if you read the text retranslated a few times and I wanted to do it automatically with a script but while i was trying this i "get" an error. My code is ok because i get the answer if I save all to a var and the I call setTimeout to a function that prints that var but it's not good idea because js gets crazy because it sends to google the request but continues with the rest of the loop and if i want to include something more between the diferent translations I can't. I don't want to continue before I get the answer from Google so, how can I stop js loop until I get an answer from Google?

Thanks!