第一个警报给我结果I,但第二个警报没有。我想让json_text
全球化,我该怎么做?
window.json_text = "i want this global!";
$.getJSON('http://localhost:8000/views/points_retriever/', function(data) {
//data is the JSON string
json_text = "[";
for (i = 0; i < data.length; i++) {
json_text += '{ x: "' + data[i][0]/100 + '", y: "' + data[i][1]/100 + '", note: "' + data[i][2] + '"},';
}
json_text = json_text.substring(0, json_text.length-1);
json_text += "]";
alert(json_text);
});
alert(json_text);