ajax - Ajax 调用返回未定义对象
问题描述
我正在进行 ajax 调用,但是在调试时我得到了未定义的对象:
var model;
$.ajax({
type: "GET",contentType: "application/json; charset=utf-8",
datatype: "json", async: false,
url: "http://Test/ws/api/v1/account?id=48099",
headers: {'XIDENTITY':'{"guid":null,"login":"Test01","password":null}'},
error: function (xhr, textStatus, errorThrown) {alert(textStatus + " " + errorThrown);},
success: function (data, textStatus, xhr)
{
var response = data.d.results;
var Record = JSON.parse(JSON.stringify(response[0]));
model=Record.model;
}
});
返回模型;
解决方案
推荐阅读
- reactjs - 我如何将 redux 操作移动到单独的文件
- azure - Azure 条件访问,专门通过 Azure VPN 客户端
- mysql - MySQL - 选择另一个表中条目最多的条目
- javascript - Django 使用 Ajax 进行动态过滤
- api - 如何在 Swiftui Ios 模拟器屏幕中显示发布方法请求数据?
- javascript - 调度中的返回函数没有被调用!redux-thunk
- laravel - 如何在 /bootstrap 4.6 应用程序中正确显示 datetimepicker?
- python - 使用 pyinstaller 时,图像未显示在 tkinter 顶层
- dart - Dart smartcast 不能使用两个泛型
- php - SQLSTATE[HY000]:一般错误:1 ON CONFLICT 子句与测试环境中的任何 PRIMARY KEY 或 UNIQUE 约束不匹配错误