我想回显此数组数据,我保存在obj.format上。但我无法将此obj.format回显到url。像这样的脚本
$(".monitor").click(function() {
$("#list-format").html("");
let nama_puskesmas = $(this).data('nama');
let id_puskesmas = $(this).data('id');
let nomor = $(this).data('nomor');
let base_url = '<?php echo base_url();?>'
$.ajax({
url: 'get_data',
method: 'post',
dataType: 'json',
data: {
id_puskesmas: id_puskesmas
},
success: function(response) {
$.each(response, function(i, obj) {
$("#list-format").append("<li>" + obj.format + "</li>");
});
$("#title-modal").html(nama_puskesmas);
$("#exampleModalCenter").modal('show');
$("#button-submit").html(`<a href="${base_url}dinas/view_monitor/${id_puskesmas}" id="submit_modal" class="btn btn-primary">Lihat data</a>`)
$("#button-submit2").html(`<a href="https://wa.me/${nomor}?text=Laporan%20Yang%20Masih%20Belum%20Lengkap%20Adalah%20Sebagai%20Berikut%20Ini$(obj.format)" id="submit_modal" class="btn btn-primary">Kirim Pesan</a>`)
}
})
})
在此脚本中,我们具有obj.format。
$。each(response,function(i,obj){ $(“#list-format”)。append(“
我会将这些数据回显到此链接href(在id =“ submit_modal”之前的最后几个字上):
$(“#button-submit2”)。html(<a href="https://wa.me/${nomor}?text=Laporan%20Yang%20Masih%20Belum%20Lengkap%20Adalah%20Sebagai%20Berikut%20Ini$(obj.format)" id="submit_modal" class="btn btn-primary">Kirim Pesan</a>
)