我在这里很新。
你能指出如何使用jQuery在链接的右侧放置一个功能按钮吗?
因此:
if(field ==="anexo_v"){
if(value !==null){
$(".anexo_v").show();
var link = "";
$.each(value,function(id, valor){
var anexo = valor.anexo;
anexo = anexo.split("/");
anexo = $(anexo).get(-1);
//console.log(valor.anexo);
link = link+"<p><a href=\'"+valor.anexo+ "\' target=\'_blank\'>"+anexo+"</a></p>"; ;
});
$("#anexo").html(link);
}else{
$(".anexo").hide();
}
}
另外 - 这个按钮需要通过Ajax调用PHP Codeigniter的控制器来执行删除(Excluir意味着删除)。
提前致谢!
答案 0 :(得分:0)
更改
link = link+"<p><a href=\'"+valor.anexo+ "\' target=\'_blank\'>"+anexo+"</a></p>";
到
link = link+"<p style=\'display:inline\'><a href=\'"+valor.anexo+ "\' target=\'_blank\'>"+anexo+"</a></p><button value=\'Excluir\' onclick=\'functionToMakeAjaxCall("+valor.anexo+")\'></button>";
并添加
function functionToMakeAjaxCall(parameter){
//code to make ajax call to a controller to delete
}