onclick事件的传值 然后去执行ajax请求

时间:2024-11-19 07:53:27
$.ajax({ url: 'http://localhost:8080/housedish/findloupantable', type: 'get', datatype: 'json', success: function (res) { console.log(res); var str = " "; str += "<table id=\"lp\" width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bgcolor=\"#749cdf\">\n" + " <thead><tr class=list align=\"center\">" + "<td width=\"10%\" align=\"center\" bordercolor=\"#6666FF\">楼盘名称</td>" + "<td width=\"15%\" align=\"center\" bordercolor=\"#6666FF\">楼盘信息</td>" + "<td width=\"10%\" align=\"center\" bordercolor=\"#6666FF\">项目负责人</td>" + "<td width=\"25%\" align=\"center\" bordercolor=\"#6666FF\">预售许可证号</td>" + "<td width=\"15%\" align=\"center\" bordercolor=\"#6666FF\">楼盘状态</td>" + "<td width=\"5%\" align=\"center\" bordercolor=\"#6666FF\">资料员</td>" + "</tr></thead><tbody>"; $.each(res, function (index, element) { str += "<tr class=toplist οnmοuseοver=mouseovertr(this) οnmοuseοut=mouseouttr(this) **onClick=\"findOne(" + element['hdid'] +")**\">" + "<td>" + element['hdname'] + "</td>" + "<td>" + element['hdcompany'] + "</td>" + "<td>" + element['dlname'] + "</td>" + "<td>" + element['dllicense'] + "</td>" + "<td>" + element['hdstatus'] + "</td>" + "<td>" + element['siname'] + "</td>" + "</tr>"; }) str += "</tbody></table>"; $('body').append(str); }