I want to make a modal edit form to show up after clicking certain button in HTML. This is the javascript :
<script>
var edit;
jQuery( document ).ready(function( $ ) {
// Edit Data (Modal and function edit data)
edit = function edit(id, un, nl, em, nh, st) {
//$('#myModal').attr('action', '{{ url('user/edit') }}/'+id;
$('#footer_action_button').text("Update");
$('#footer_action_button').addClass('yellow btn-outline');
$('.btn').addClass('edit');
$('.modal-title').text('Edit Pengguna');
$('.delete').hide();
$('.form-horizontal').show();
$('#un').val(un);
$('#nl').val(nl);
$('#em').val(em);
$('#pw').attr('placeholder', 'Isi Jika Ingin Diganti');
$('#nh').val(nh);
$('#st').val(st);
$('#myModal').modal('show');
}
});
</script>
With this code, the modal form shows up, but I can't do the update because there's no url involved. And so, when I add modal action (simply remove the comment tag) I got error that my edit function is not defined. For now I only write my JS code in this question beacuse I don't see other codes related, but let me know if you need an update.
Regards.