json数据如何赋值给<img>标签的src
我的js是这样写的
function auto(id, code, json, flag)
{
$('#' + id).autocomplete(json,
{
max: 12, //列表里的条目数
minChars: 0, //自动完成激活之前填入的最小字符
width: 150, //提示的宽度,溢出隐藏
scrollHeight: 300, //提示的高度,溢出显示滚动条
matchContains: true, //包含匹配,就是data参数里的数据,是否只要包含文本框里的数据就显示
autoFill: false, //自动填充
formatItem: function(row, i, max)
{
if (false)
return row.name + " - [" + row.pinyin + "]";
else
return row.name + " - " + row.code;
},
formatMatch: function(row, i, max)
{
if (false)
return row.pinyin + row.name + row.code;
else
return row.name + row.code;
},
formatResult: function(row)
{
return row.name;
}
}).result(function (event,row,formatted)
{
$('#' + id).val(row.name);
$('#' + code).val(row.code);
$.getJSON('${ctx}/company/showcompany.do?companyIDs=' + row.name,function(json){
if(json)
{
//公司ID
var companyID = json.companyID;
$('#companyIDs').val(companyID);
var corpName = json.corpName;
$('#corpNames').val(corpName);
var corpNameFull = json.corpNameFull;
$('#corpNameFull').val(corpNameFull);
var corpNameEn = json.corpNameEn;
$('#corpNameEn').val(corpNameEn);
var address = json.address;
$('#address').val(address);
var postCode = json.postCode;
$('#postCode').val(postCode);