代码警告'对象对象'

My code is this:

var username = "john";
var password = "doe";

var url = '//api.bos2.cf/?type=verify&username=' + username + '&password=' + 
password + '&callback=?';
$.getJSON(url, function(data) {
  success: readData(data)
});

function readData(data) {
  alert(data);
}

Although this code alerts object Object instead of {'success' : false, 'msg' : 'Unknown API function'}

Any Ideas as to why this is happening??

Thanks,

CSF

You are trying to display the raw object. You need to turn it into a string first:

function readData(data) {
  alert(JSON.stringify(data));
}
function readData(data) {
  alert(data.success);
  alert(data.msg);
}

just go through simple way.