The following JS function should be sending out a GET request to
with
?query=toast
function sendRequest(str){
var request = new XMLHttpRequest();
console.log('sending request');
request.onreadystatechange = function() {
if (request.readyState == XMLHttpRequest.DONE) {
json=request.responseText;
//json.forEach(function(obj) {
//});
for (word in json){
var row=table.insertRow();
var scoreC=row.insertCell();
var wordC=row.insertCell();
scoreC.innerHTML=json[word];
wordC.innerHTML=word;
}
} else {
concole.log("Silence on the line");
}
}
request.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
request.open('GET', 'http://127.0.0.1:5000/api.xml?query='+str, true);
request.send();
// and give it some content
//var newContent = document.createTextNode(resp);
//console.log(resp.responseType);
}
Instead, it always queries
ignoring the fact that I required a GET on