你能指出如何使用jQuery在链接的右侧放置一个按钮吗?

时间:2016-11-03 13:42:40

标签: php jquery json ajax codeigniter

我在这里很新。

你能指出如何使用jQuery在链接的右侧放置一个功能按钮吗?

Site's picture

因此:

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意味着删除)。

提前致谢!

1 个答案:

答案 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
}