我正在尝试循环我在查询中收到的键/值对并控制台输出电子邮件地址。我做错了什么?
我收到的 JSON...
{"ERRORS":[],"DATA":[{"INCENTIVEID":"1","CREATED":"","EMAIL":"email","RECIPIENTID":"1","NAME":"glyn","ACTIVE":0,"MODIFIED":"","MOBILE":"11111111111"},{"INCENTIVEID":"1","CREATED":"","EMAIL":"eee","RECIPIENTID":"2","NAME":"edem","ACTIVE":0,"MODIFIED":"","MOBILE":"11111111111"}],"MESSAGES":[]}
当前脚本
$(document).ready(function(){
var digits = /^\d{11}$/;
$("#mobile").on("keyup keypress", function(){
if (digits.test(this.value)) {
$.ajax({
url: "http://api.domain.com/recipients/lookup",
data: {
mobile: this.value,
incentiveID: $("#incentiveID").val()
},
success: function(data){
$.each(data.DATA, function(index, value) {
console.log(value.EMAIL);
});
console.log(data);
}
});
}
});
});