0
对象后,我有这样的AJAX jQuery代码:访问AJAX功能
$("#serial_number").submit(function(e) {
var url = "/getVoucher"; // the script where you handle the form input.
$.ajax({
type: "GET",
url: url,
data: $("#serial_number").serialize(),
dataType: "json",
success: function(data)
{
console.log(data);
}
});
e.preventDefault(); // avoid to execute the actual submit of the form.
});
我怎样才能访问对象代码元素?
我尝试使用:data.Code也尝试data.Description但浏览器给我错误...如何访问Ajax代码中的成功函数内?
看起来像是双重嵌套,如果你仍然在控制台日志中看到'data',试试'data.data.Code'? –
是的,那是一个错误...非常感谢 –