Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //controller
- public ajax_method(){
- //fill with your data
- $data = array('success'=>true);
- if($this->input->is_ajax_request()){
- $this->output
- ->set_content_type('application/json')
- ->set_output(json_encode($data));
- }else{
- //for example show_404()
- }
- }
- //jq script
- $.getJSON("url",function(data){
- console.log(data);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement