What I pasted is everything I have in this code. I only tested it to check 
if it works. The code is the same as in google example from the webiste:
https://developers.google.com/translate/v2/getting_started?hl=pl
I only add my app Id to it. It's strange for me that , this example 
doesn''t work...


W dniu piątek, 19 października 2012 16:53:12 UTC+2 użytkownik jgeerdes 
[AJAX APIs "Guru"] napisał:
>
> It's really hard to say what's going on simply by looking at the code. Can 
> you provide a link to your page, working or not? That way we can wield some 
> debugging tools on the thing. Alternatively, you might want to use 
> WebKit/Chrome/Safari debugging tools or Firebug to check for error messages 
> in the server's response. The new version of the API, in general, provides 
> much more useful error messages than the old one did.
>
> It might also benefit you to post to the dedicated Translate API forum, 
> linked below:
>
> https://groups.google.com/forum/#!forum/google-translate-api
>
> Jeremy R. Geerdes
> Generally Cool Guy
> Des Moines, IA
>
> For more information or a project quote:
> [email protected] <javascript:>
>
> If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan 
> Church!
>  
> On Oct 19, 2012, at 7:41 AM, Marcin Mazanek wrote:
>
> Hello, 
> I tried to check the example from the api Google Translate page on my 
> domain (from referer restriction), I put this simple code, from google docs:
>
> <html>
>   <head>
>   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
>     <title>Translate API Example</title>
>   </head>
>   <body>
>     <div id="sourceText">Hello world</div>
>     <div id="translation"></div>
>     <script>
>       function translateText(response) {
>         document.getElementById("
> translation").innerHTML += "<br>" + 
> response.data.translations[0].translatedText;
>       }
>     </script>
>     <script>
>       var newScript = document.createElement('script');
>       newScript.type = 'text/javascript';
>       var sourceText = 
> escape(document.getElementById("sourceText").innerHTML);
>       // WARNING: be aware that YOUR-API-KEY inside html is viewable by 
> all your users.
>       // Restrict your key to designated domains or use a proxy to hide 
> your key
>       // to avoid misuage by other party.
>       var source = '
> https://www.googleapis.com/language/translate/v2?key=*******&source=en&target=de&callback=translateText&q=<https://www.googleapis.com/language/translate/v2?key=AIzaSyBTiDt3z0xVZd52E6FbPO_fMjs0j6i_0cM&source=en&target=de&callback=translateText&q=>'
>  
> + sourceText;
>       newScript.src = source;
>
>       // When we add this script to the head, the request is sent off.
>       document.getElementsByTagName('head')[0].appendChild(newScript);
>     </script>
>   </body>
>   </html>
>
>
> But I received na error in firebug:
>
> TypeError: response.data is undefined
>
> ...lementById("translation").innerHTML += "<br>" + 
> response.data.translations[0].tr...
>
>
> I don't really know. What is wrong ?
>
> Could you help me?
>
> I will appreciate it.
>
> Marcin
>
> -- 
> You received this message because you are subscribed to the Google
> Groups "Google AJAX APIs" group.
> To post to this group, send email to
> [email protected] <javascript:>
> To unsubscribe from this group, send email to
> [email protected] <javascript:>
> To view this message on the web, visit
> https://groups.google.com/d/msg/google-ajax-search-api/-/SvXl3Q8hbEEJ
> For more options, visit this group at
> http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en
>
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Google AJAX APIs" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
To view this message on the web, visit
https://groups.google.com/d/msg/google-ajax-search-api/-/QntDbqvx0VYJ
For more options, visit this group at
http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en

Reply via email to