How to use getJson function in jquery ajax?

$.getJson()

File Name :

function somefunction() {
$data = $this->Common_model->get_all_students();
echo json_encode($data);
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#button").click(function(){
$.getJSON("<?php echo base_url(); ?>controllername/myfunction", function(result){
$.each(result, function(i, field){
$("div").append(field + " ");
});
});
});
});
</script>







Previous Next


Trending Tutorials




Review & Rating

0.0 / 5

0 Review

5
(0)

4
(0)

3
(0)

2
(0)

1
(0)

Write Review Here