1 回答

TA貢獻1830條經(jīng)驗 獲得超9個贊
<script>
$('.form-check-input').on('click', function() {
const menuId = $(this).data('menu');
const roleId = $(this).data('role'); // roleId = <? $role[‘id’] ?> so php did not echo role id here
$.ajax({
url: "<?= base_url('admin/changeaccess'); ?>",
type: 'post',
data: {
menuId: menuId,
roleId: roleId
},
success: function() {
document.location.href = "<?= base_url('admin/roleaccess/'); ?>" + roleId;
}
});
});
</script>
對于解決方案,請更改您的form-check-input元素
<... class=“form-check-input” data-role=“<?php echo $role[‘id’]; ?>” data-menu=“echo menu variable” ...>
如果這樣無法共享form-check-input按鈕的html
- 1 回答
- 0 關(guān)注
- 147 瀏覽
添加回答
舉報