I'm trying to call the ajax once user had onclick
on the button, then the button will be passing the id to the controller to output the result in my modal's div. However when I debug it show me the action you requested is not allowed.
Is there anything I can do about it on my code?
View :
<input type="" name="" value="VIEW" class="btn btn-primary m-t-15 waves-effect" data-toggle="modal" data-target="#defaultModal" onclick="refresh_detail('.$row["Task_ID"].')">
jQuery / AJAX Code:
<script type="text/javascript">
function refresh_detail(id){
$.ajax({
url : "<?= base_url()?>admin/Admintask/get_task_detail",
type : "POST",
dataType : "json",
data : {"TaskID" : id},
success : function(data) {
// do something
},
error : function(data) {
// do something
}
});
}
</script>
Controller :
public function get_task_detail(){
echo $this->input->post('TaskID');
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…