var sql = ''; function toJsondata(){ sql = ''; var array = new Array(); $.each(data, function(i, o){ if(o.A!=undefined&&o.A.length>0){ var ss = o.A.split(' '); sql += "insert ignore into dc_professional(id, name, pid) values('"+ss[0]+"','"+ss[1]+"','"+ss[0].substr(0, ss[0].length-2)+"');"; } if(o.B!=undefined&&o.B.length>0){ var ss = o.B.split(' '); sql += "insert ignore into dc_professional(id, name, pid) values('"+ss[0]+"','"+ss[1]+"','"+ss[0].substr(0, ss[0].length-2)+"');"; } if(o.C!=undefined&&o.C.length>0){ var ss = o.C.split(' '); sql += "insert ignore into dc_professional(id, name, pid) values('"+ss[0]+"','"+ss[1]+"','"+ss[0].substr(0, ss[0].length-2)+"');"; } if(o.D!=undefined&&o.D.length>0){ var ss = o.D.split(' '); sql += "insert ignore into dc_professional(id, name, pid) values('"+ss[0]+"','"+ss[1]+"','"+ss[0].substr(0, ss[0].length-2)+"');"; } if(o.E!=undefined&&o.E.length>0){ var ss = o.E.split(' '); sql += "insert ignore into dc_professional(id, name, pid) values('"+ss[0]+"','"+ss[1]+"','"+ss[0].substr(0, ss[0].length-2)+"');"; } }) }