Bladephp: Now with 8+ codeigniter, php, and laravel project 8+ php project From $37/Month From Rs. 2499/Month

How to Call ajax in Codeigniter

by
Category:codeigniter
php ajax codeigniter
 How to Call ajax in Codeigniter

Getting data through Ajax is very cool, and when we can reuse the CodeIgniter views to get the Ajax data, the overall user experience become much more enhanced. So, in this tutorial I would show you how to call Ajax in controller.

This is a tutorial where I am not going to talk about how to get the Ajax data just how to call Ajax in controller.

Ajax call to Controller

$('.challan').blur(function(){
	var challanno = $(this).val();
	$.ajax({
		type:'POST',
		url:"Challan/CheckChallanNumber",
		data: {challanno: challanno},
		dataType: 'JSON',
		success:function(data){

		}
	 });
});

Controller Function

public function CheckChallanNumber()
{
    $challanno = $this->input->post('challanno');
    print_r($challanno);
    die;
}

0 Comments


Html code work in comment box


Related Post