title: Translate Texts using ajax and google translate API
body: <p>I wanted to execute this function and make an ajax call when I click in a button in my html, but seems that the API Url is deprecated because I get an error in my console : Uncaught TypeError: Cannot read property 'translatedText' of null</p>
  
  <p>ANY IDEA? Thanks</p>
  
  <p>This is my javascript function:</p>
  
  <pre><code>function translateCaption() {
  $.ajax({
      url: 'https://ajax.googleapis.com/ajax/services/language/translate',
      dataType: 'jsonp',
      data: {
          q: 'Hello world!',  // text to translate
          v: '1.0',
          langpair: 'en|es'
      },   // '|es' for auto-detect
      success: function (result) {
          alert(result.responseData.translatedText);
      },
      error: function (XMLHttpRequest, errorMsg, errorThrown) {
          alert(errorMsg);
      }
  });
  }
  </code></pre>
  
  <p>And this is my html:</p>
  
  <pre><code>&lt;button onclick="translateCaption()" class="button-translate" type="button"&gt;Translate&lt;/button&gt;
  </code></pre>