1.当$.get()得不到图片时,需要把两个图片的属性设置为相同的name
![](@routes.Assets.versioned("img/logo_box.png"))
![]({{logoUrl}})
2.$get()到数据,用for循环显示出来
for
$.get("/cservices/" + serviceId, '')
.done(function(data, status, xhr) {
for(var key in data){
if(key != 'avatarUrl' && key != 'wechatQRUrl'){
$('[name="'+ key +'"]').attr('value', data[key]);
}
}
$('#imgHeadPhoto').attr('src',data.avatarUrl);
$('#imgWechat').attr('src',data.wechatQRUrl);
}).always();
base
$.get("/user/extra", '')
.done(function(data, status, xhr) {
$('[name="eid"]').val(data.eid);
$('[name="userId"]').val(data.userId);
$('[name="imgLogo"]').prop('src',data.logoUrl);
$('[name="crocsAddress"]').val(data.crocsAddress);
$('[name="companyAddress"]').val(data.companyAddress);
$('[name="contactPhone"]').val(data.contactPhone);
$('[name="salesPhone"]').val(data.salesPhone);
$('[name="qq"]').val(data.qq);
}).always();