I have a problem with ajax call in codeigniter. This is the javascript code:
$.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 {
}
}
});
And controller function is:
<?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');
}
}
Every time I got 404 error for Ajax call and the url is correct.
Can you help me please?
Thank you!!
question from:
https://stackoverflow.com/questions/65899439/codeigniter-ajax-call-404 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…