Here is my field from where we want to send values to modal
<a href="<?= '/permissions/edit/'.$permission['id']; ?>">
<button class="btn btn-info btn-icon btn-icon-mini btn-round"><i class="zmdi zmdi-edit">
</i></button></a>
</a>
-------------------------------------It is our modal---------------------------------
<div class="modal fade" id="modal_popup" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog modal-sm" role="document">
<form action="<?php echo base_url(); ?>/permissions/status_changed" method="post">
<div class="modal-content">
<div class="modal-header" style="height: 150px;">
<h4 style="margin-top: 50px;text-align: center;">Are you sure, do you change status?</h4>
<input type="hidden" name="id" id="user_id">
<input type="hidden" name="status" id="user_status">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger pull-left" data-dismiss="modal">No</button>
<button type="submit" name="submit" class="btn btn-success">Yes</button>
</div>
</div>
</form>
</div>
</div>
//Our Jquery Code
<script type="text/javascript">
$(function() {
//For Status Update
$(".user_status").on("click", function() {
var firstValue = $(this).data('uid');
//alert(firstValue);
var secondValue = $(this).data('ustatus');
$("#user_id").val(firstValue);
$("#user_status").val(secondValue);
});
});
</script>
No comments:
Post a Comment