09-25-2019, 09:59 PM
I need to pass some values from my controller to view.
Here is my controller.
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
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);
}
});