I am currently working with AJAX code:
<script type="text/javascript">
$(".monitor").click(function(){
$("#list-format").html("");
let facility_name = $(this).data('nama');
let facility_id = $(this).data('id');
let number = $(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(facility_name);
$("#exampleModalCenter").modal('show');
$("#button-submit").html(`<a href="${base_url}dinas/view_monitor/${facility_id}" id="submit_modal" class="btn btn-primary">View Data</a>`)
$("#button-submit2").html(`<a href="https://wa.me/${number}?text=Incomplete%20Report%20Details:%20Below%20is%20the%20List." id="submit_modal" class="btn btn-primary">Send Message</a>`)
}
})
})
</script>
When executed, the program will display the following data:
Data that has not been uploaded yet:
1. Form Lap PTM
2. Form Lap Posbindu
3. Form Lap IVA
4. Form Lap Jiwa
5. Form Lap Indera dan Gimul
6. Form Lap Diare
7. Form Lap LROA
8. Form Lap Thypoid
9. Form Lap Laporan Hiv Aids dan IMS
10. Form Laporan Hepatitis
I intend to pass this data to another function through an echo statement.
Is there a way to store this data as a variable?
$.each(response, function(i, obj){
$("#list-format").append("<li>"+obj.format+"</li>");
});
To display it using this code:
$("#button-submit2").html(`<a href="https://wa.me/${number}?text=Incomplete%20Report%20Details:%20Below%20is%20the%20List." id="submit_modal" class="btn btn-primary">Send Message</a>`)
Alternatively, can I replace the content of #button-submit2 by echoing the data?