Javascript 使用jQuery创建动态行并在单元格中插入链接

Javascript 使用jQuery创建动态行并在单元格中插入链接,javascript,jquery,json,Javascript,Jquery,Json,有人能帮我吗?错在哪里?或者如何在td中放置链接 var c = []; $.each(resp, function(i, item) { var a = $('<a>'); a.attr('title', "aaa"); a.attr('rel', "{handler: 'iframe', size: {x: 600, y: 400}}"); a.text("bbbbb"); a.addClass

有人能帮我吗?错在哪里?或者如何在
td
中放置链接

 var c = [];
 $.each(resp, function(i, item) {             
    var a = $('<a>');
      a.attr('title', "aaa");
      a.attr('rel', "{handler: 'iframe', size: {x: 600, y: 400}}");
      a.text("bbbbb");
      a.addClass('modal toolbar');

     c.push("<tr><td>" + item.libelle_client + "</td>");
     c.push("<td>" + item.date_debut + "</td>");
     c.push("<td>" + item.date_debut + "</td>");
     c.push("<td>" +a + "</td>");
     c.push("<td>" + item.date_fin + "</td></tr>");               
 });
var c=[];
$每个(分别,职能(i,项目){
变量a=$('');
a、 attr(‘头衔’,‘aaa’);
a、 attr('rel',“{handler:'iframe',大小:{x:600,y:400}”);
a、 文本(“BBB”);
a、 addClass(“模态工具栏”);
c、 推送(“+item.libelle_client+”);
c、 推送(“+item.date\u首秀+”);
c、 推送(“+item.date\u首秀+”);
c、 推动(“+a+”);
c、 推送(“+item.date\u fin+”);
});
用这个我得到了这个

雷诺2020-03-27 2020-03-27[目标]2020-03-31

我希望有一个链接,而不是
[object object]
谢谢

更改为

 c.push("<td>" + a[0].outerHTML + "</td>");
c.push(“+a[0].outerHTML+”);
这是脏的,但应该可以使用。

更改为

 c.push("<td>" + a[0].outerHTML + "</td>");
c.push(“+a[0].outerHTML+”);

这是脏的,但应该可以工作。

您可以显示
resp
?$response=array();foreach($ligne形式的服务){$response[]=array('libelle\u client'=>$ligne->libelle\u client,'date\u首秀'=>$ligne->date\u首秀,'date\u fin'=>$ligne->date\u fin,'id'=>$ligne->id);}我的回答对您没有帮助吗?您能显示
resp
?$response=array();foreach($ligne服务){$response[]=array('libelle\u client'=>$ligne->libelle\u client,'date\u首秀'=>$ligne->date\u首秀,'date\u fin'=>$ligne->date fin,'id'=>$ligne->id);}我的回答对你没有帮助吗?