Welcome Guest, Not a member yet? Register   Sign In
Codeigniter and ajax query involving one more view
#1

I am trying to call an AJAX output involving classic MVC scheme. My jquery method is communicating with controller and I can catch the variables sent by the jquery. What ever is being printed in the contoller is correctly showing back in jquery alert box ... However I can not get to my jquery method anything from the view called by the controller which is supposed to generate the ajax output. I know that I can simply printout all in the controller I just don't feel comfortable to generate an HTML view in controller.  
I ma using a codeigniter 2.
This is the calling jquery method in my view:
Code:
$.ajax({
       type: "POST",
       url: "<?php echo base_url();?>admin/get_promos/",
       cache: false,
       data: {promos_id: JSON.stringify(jsonObj)},
       success: function(data){
              alert(JSON.stringify(data));
       }
   });
Here is my controller :
Code:
public function get_promos(){
       if (!$this->input->is_ajax_request())
       {
           exit('No direct script access allowed');
       }
       else {
           $data['promos_id'] = $this->input->post('promos_id');
           echo $data['promos_id'];
           $this->view->load('list_promo_estab_ajax', $data);
       }
   }
And here is my view 'list_promo_estab_ajax.php' which I am trying to load in the above controller, but nothing gets back to my jquery method :
Code:
<?php
echo 'basic blah';
?>
Reply


Messages In This Thread
Codeigniter and ajax query involving one more view - by ronlin - 12-28-2015, 11:57 PM



Theme © iAndrew 2016 - Forum software by © MyBB