I'm facing an issue with an AJAX call in CodeIgniter. Here is the JavaScript code I am using:
$.ajax({
method: "POST",
url: MY_CONSTANT + "login/autentificare",
data: {
login_email: login_email,
login_password: login_password
},
success: function(result) {
result = JSON.parse(result);
console.log(result);
if (result.errors) {
if (result.errors.length > 0) {
swal.fire({
text: result.errors,
icon: "error",
buttonsStyling: false,
confirmButtonText: "Ok, got it!",
customClass: {
confirmButton: "btn font-weight-bold btn-light-primary"
}
}).then(function() {
KTUtil.scrollTop();
});
}
} else {
}
}
});
Here is the controller function:
<?php defined('BASEPATH') OR exit('No direct script access allowed');
class Login extends MY_Controller {
public function index() {
$this->load->view('login/login');
}
public function autentificare() {
die('test');
}
}
Despite having the correct URL, I continually receive a 404 error for the AJAX call. Can anyone assist me with this issue?
Thank you!!