Ok, found my problem, although I had to use javascript ajax queries. I was right to think the data I was recuperating throught my ajax query was not in the right format. I did:

var data = JSON.parse(this.response); //Instead of this.responseText

var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {

    var data = JSON.parse(this.response);

};"GET", url, true);

Related Query

More Query from same tag