I know this question hast probably been asked a thousand times, but i cannot seem to find the answer. I want result
to be the data returned from the ajax-request, which should be a json-data array (the result of console.log(data)
).
var result = $.ajax({
type: 'GET',
url: dataPath,
dataType: 'json',
success: function(data) {
console.log(data)
},
error: function(){
//alert("damn");
},
data: {},
aync: false
});
console.log(result);
However, console.log(result);
will return some strange object, which I don't know how to handle. Why isn't result
= data
?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…