I'm trying to change my routing page in codeiginiter. how can i change my default controller
Someone already do this?
Thanks.
I'm trying to change my routing page in codeiginiter. how can i change my default controller
Someone already do this?
Thanks.
By calling Ajax Api in your JavaScript file, you can call controller
for these you can follow below steps -
$.ajax({
url: "users/get_client_details",
type: "POST",
data: {"userId": id},
async: false,
dataType: 'json',
success: function (response) {
if (response.status === "false") {
alert("Please Enter Correct id.");
}
}
});
$route['users/get_client_details'] = 'users/fetch_client_details';
Now you can access your controller from JavaScript.
In the past, I have set up a route for the ajax request. Something like this:
$route['admin/search/(:any)'] = 'admin_controller/admin/do_search/$1';
Then my ajax request would look like this: AJAX Request
$.ajax({
type : 'POST',
data : 'your data',
url : '<?php array('controller'=>'abc','action'=>'you function')?>',
success : function(data){
alert(success)
}
});