Skip to content
Snippets Groups Projects
Commit 223c1589 authored by Arnaud Levy's avatar Arnaud Levy
Browse files

climate

parent 4540f744
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,7 @@ window.osuny.translation = {
this.start.addEventListener('click', this.run.bind(this));
this.url = this.component.dataset.translationUrl;
},
run: function () {
'use strict';
this.start.hidden = true;
......@@ -34,13 +34,15 @@ window.osuny.translation = {
'use strict';
var text = field.value,
xhr = new XMLHttpRequest(),
that = this;
that = this,
data,
translatedText;
xhr.open('POST', this.url, false);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onreadystatechange = function () {
if (this.readyState === 4 && this.status === 200) {
var data = JSON.parse(this.responseText),
translatedText = data.translatedText;
data = JSON.parse(this.responseText);
translatedText = data.translatedText;
that.translateField(field, translatedText);
}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment