I do not know why when I try to make a ajax call to the url " link " I get a 404 error saying the following " The url link "was not found on the server (404). I can not find where the ".html" that he is adding after the controller name comes from, the application is running perfectly on another server.
I do not know where the problem comes from, but I'll post the .htaccess to see if it is an error in it:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
And this is the thread that makes the request:
var controller = 'login';
var base_url = '<?php echo base_url();?>';
function validaLogin() {
$.ajax({
'url' : base_url + controller + '/ax_validaLogin',
'type' : 'POST', //the way you want to send data to your URL
'data' : {'username': document.getElementById('username').value,
'senha' : document.getElementById('senha').value
},
'success' : function(data){ //probably this request will return anything, it'll be put in var "data"
var container = $('#errorMessage'); //jquery selector (get element by id)
if(data == "sucesso") {
window.location.href='home';
}
else {
if(data){
container.html(data);
$("#erroLogin").show();
focusLogin();
}
}
}
});
}
Remembering that I'm using Codeigniter 2, PHP5.6 and Apache2 on Linux Mint 18.