Skip to content
Advertisement

ajax code contains “PHP site_url” with parameters in ajax

I want to ask, is it possible, if the ajax code contains “PHP site_url” with parameters in ajax

this is the specific code:

"<a class='btn btn-info' href="<?php 'echo site_url("data_detail/detail_datas/vieworc/ " + item.NIK + "); '?>">Detail</a>"

this is the full code:

                 .done(function(dt){
                        if(dt != null){
                            console.log(dt)
                            table.rows().remove().draw();
                            $.each(dt, function(i, item){
                                table.row.add([
                                    item.Name,
                                    item.NIK,
                                    item.gender,
                                    item.PositionDesc,
                                    item.Shift,
                                    item.tgl,
                                    item.Attendance,
                                   "<a class='btn btn-info' href="<?php 'echo site_url("data_detail/detail_datas/vieworc/ " + item.NIK + "); '?>">Detail</a>"
                                ]).draw();
                            })
                        }
                    })
                });

Advertisement

Answer

please try this

"<button type='button' class='btn btn-success' onclick='showDetail(""+ item.NIK + "");' >Detail</button>"
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement