Wednesday, August 1, 2018

javascript - console.log(result) returns [object Object]. How do I get result.name?

My script is returning [object Object] as a result of console.log(result).



Can someone please explain how to have console.log return the id and name from result?



$.ajaxSetup({ traditional: true });

var uri = "";


$("#enginesOuputWaiter").show();
$.ajax({
type: "GET",
url: uri,
dataType: "jsonp",
ContentType:'application/javascript',
data :{'text' : article},
error: function(result) {
$("#enginesOuputWaiter").hide();

if(result.statusText = 'success') {
console.log("ok");
console.log(result);
} else {
$("#enginesOuput").text('Invalid query.');
}
}
});

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...