我正在尝试使用请求的响应在页面加载后设置其值,但是获取该值的函数返回未定义的值。
public int? Id { get; set; }
public string Name { get; set; }
public int AccountGroupTypeId { get; set; }
public vitual ICollection<AccountGroupType> AccountGroupTypes { get; set; }
public int AccountPrimaryGroupId { get; set; }
public virtual ICollection<AccountPrimaryGroup> AccountPrimaryGroups { get; set; }
public DateTime CreationDateUtcNow{ get; set; }
public AccountGroup()
{
this.AccountGroupTypes = new HashSet<AccountGroupType>();
this.AccountPrimaryGroups = new HashSet<AccountPrimaryGroups>();
}
答案 0 :(得分:0)
这不是您使用async
函数的方式。正确的是:
const getToken = () => new Promise((resolve) => {
$.get("example.endpoing.org").success(resolve);
});
$(document).ready(async () => {
var token = await getToken();
$("#access_token").val(token);
});