ajax动态获取的数据有空字段,拼接html会在页面显示undefined
解决方法:
利用三目运算符
将""+item.value+"“改为
“”+(item.value==undefined?”——":item.value)+""
记得要加括号,为undefined时要改为显示的方式用引号括起来。
ajax动态获取的数据有空字段,拼接html会在页面显示undefined
解决方法:
利用三目运算符
将""+item.value+"“改为
“”+(item.value==undefined?”——":item.value)+""
记得要加括号,为undefined时要改为显示的方式用引号括起来。