Unable to get my bing translate api ajax call to work,

I am mock testing the Bing translate api, and attempting to do a very very basic translation of converting the innerHTML of a div into the specified languages. so pretty basic, but unable to find where my code is faltering...here is the jscript :

 var Translate={ 
  baseUrl:"http://api. 
    microsofttranslator.com/V2/Ajax.svc/", 
  appId:"7EE02F58CAC8EB2208D7AE8A194A43BB0C02436A", 
  translate:function(text,from,to, 
                              callback){ 
   var s = document.createElement("script"); 
   s.src =this.baseUrl+"/Translate"; 
   s.src +="?oncomplete="+callback;  
   s.src +="&appId="+this.appId; 
   s.src +="&from" + from ; 
   s.src += "&to=" + to ; 
   s.src += "&text=" + text;  
   document.getElementsByTagName( 
              "head")[0].appendChild(s); 
  } 
 } 
 var mycallback=function(result){ 
                         alert(result)}; 


function translater() 
{ 
 text = document.getElementById('translate').innerHTML; 

 alert(Translate.baseUrl);  

// Translate.translate("Hello World",              "en","es","mycallback"); 
}

As you can see from the above, I attempt to view what Translate.baseUrl looks like but nothing alerts itself....the html is :

<input type = "button" onclick = " translater()"/>
<div id ="translate"> This is the text to be translated. </div>

i cross tested if the onclick is working by putting in alert messages in the translater function and the callback happens on the onclick event.

Thanks guys!

Answers


Need Your Help

How can I get the Google cache age of any URL or web page?

html url hyperlink website web-scraping

In my project I need the Google cache age to be added as important information. I tried to search sources for the Google cache age, that is, the number of days since Google last re-indexed the page

iPhone 5 4 Inch Screen Update

iphone xcode user-interface ios6 iphone-5

I'm updating my app for the iPhone 5. Now I've read the topics about setting the Autosize Property and I've done that.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.