Jquery 未捕获类型错误:无法读取属性';编号';未定义的

Jquery 未捕获类型错误:无法读取属性';编号';未定义的,jquery,json,Jquery,Json,我在网页上有JQuery代码,它以JSON格式从php函数中提取数据。代码仅在我单击按钮两次后执行。在chrome开发工具中,我在第一次按下按钮时看到了这个错误: 未捕获的TypeError:无法读取未定义的属性“number” // JSON Data example: { "number": "555", "street": "S La Veta Park Cir", "propertynumber": "", "city": "Orange", "s

我在网页上有JQuery代码,它以JSON格式从php函数中提取数据。代码仅在我单击按钮两次后执行。在chrome开发工具中,我在第一次按下按钮时看到了这个错误: 未捕获的TypeError:无法读取未定义的属性“number”

// JSON Data example:
{
    "number": "555",
    "street": "S La Veta Park Cir",
    "propertynumber": "",
    "city": "Orange",
    "state": "CA",
    "zip": "92868"
}

// Script

var address;
var propertyinfo;
$('.step1').siblings().hide(); // hide all except step 1

$('.search').click(function(){
    var filledaddress = $('#address').val();
    $.get("addresslibrary.php?command=parse&address="+filledaddress, function(addressdata){
        address = JSON.parse(addressdata);
    });
    $('#propertyTitle').html(address.number+' '+address.street+' '+address.propertynumber+'<br>'+address.city+' '+address.state+' '+address.zip);

    $(this).closest('.step').hide().next('.step').show();
    return false;
});
$('.back').click(function(){
    $(this).closest('.step').hide().prev('.step').show();
    return false;
});
//JSON数据示例:
{
“编号”:“555”,
“街道”:“S La Veta Park Cir”,
“propertynumber”:“,
“城市”:“橙色”,
“州”:“CA”,
“zip”:“92868”
}
//剧本
var地址;
var propertyinfo;
$('.step1').sides().hide();//隐藏除步骤1之外的所有
$('.search')。单击(函数(){
var filledaddress=$('#address').val();
$.get(“addresslibrary.php?command=parse&address=“+filleddress,function(addressdata)){
address=JSON.parse(addressdata);
});
$('propertytile').html(address.number+''+address.street+''+address.propertynumber+'
'+address.city+''+address.state+''+address.zip); $(this).closest('.step').hide().next('.step').show(); 返回false; }); $('.back')。单击(函数(){ $(this).closest('.step').hide().prev('.step').show(); 返回false; });
在回调函数中设置html

$.get("addresslibrary.php?command=parse&address="+filledaddress, function(addressdata) {
  address = JSON.parse(addressdata); 
  $('#propertyTitle').html(address.number+' '+address.street+' '+address.propertynumber+'<br>'+address.city+' '+address.state+' '+address.zip);
});
$.get(“addresslibrary.php?command=parse&address=“+filleddress,function(addressdata)){
address=JSON.parse(addressdata);
$('propertytile').html(address.number+''+address.street+''+address.propertynumber+'
'+address.city+''+address.state+''+address.zip); });
address=JSON.parse(addressdata)没有在
$之后立即执行。获取(…
),您应该尝试了解有关异步的更多信息