Welcome Guest, Not a member yet? Register   Sign In
Ajax success is not working in codeigniter
#1

I need to pass some values from my controller to view.
Here is my controller. 


Code:
public function my_function()
             {
                $data['name']=$name=$this->input->post('name');
                $data['email']=$email=$this->input->post('email');
                $data['phone']=$phone=$this->input->post('phone');
                echo 1;
            include APPPATH .'class/MyClass.php';
              }


Whenever I add the [b]include APPPATH .'class/MyClass.php';[/b] to my controller, the echo is not working, but when I remove that the echo is working and gives me an alert with "1" in my view.

Here is my ajax in view


Code:
$.ajax({
            url: "<?php echo base_url('index.php/home/my_function');?>",
            type: "POST",
            dataType:'json',
            data:  new FormData(this),
            contentType: false,
            cache: true,
            processData:false,
           success: function(data)
             {   
                alert(data);
             }
          });
Reply


Messages In This Thread
Ajax success is not working in codeigniter - by AKKU - 09-25-2019, 09:59 PM



Theme © iAndrew 2016 - Forum software by © MyBB