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
?
No comments:
Post a Comment