mercredi 15 juin 2016

Saving JSON data into an array


Is there any way I can obtain the data from a JSON file and save them into a multidimensional array in JavaScript. The JSON file is a .php file with header set to JSON.

I've tried so far:

 var questionJSONS="";
$(document).ready(function(){
        var questionJ="";
        $.getJSON("http://localhost:8080/audioMillionaire/test2.php",function(result){
        $.each(result, function(i, item){
questionJ+= "['"+result[i].qid+"','"+result[i].description+"','"+result[i].a+"']";
  });
        setArray(questionJ);       
});

});

And many other things, but none of them seem to work.


Aucun commentaire:

Enregistrer un commentaire