我的 javascript 原型函数如下所示;
ServerDataEngine.prototype.ExecuteCommand = function(command)
{
try
{
var result;
$.get(command, function (data) {
result = jQuery.parseJSON(atob(data));
console.log(result);
});
return result;
}
catch (Exception)
{
throw (new Exception("Can not connect to server"));
}
}
我这样称呼这个函数;
ServerDataEngine.prototype.ExecuteQuery = function (query)
{
console.log(this.ExecuteCommand(query));
}
在ExecuteCommand
, 一切正常,但在ExecuteQuery
,console.log(this.ExecuteCommand(command))
行产生undefined
.
问题是什么?