I want to call the codeigniter controller with ajax after the login. But when I execute it, the login page is only refreshed and ajax url isn't calling controller function of codeigniter.
I don't understand what happened. Please help?
Below is my code
function ValidateReg() {
var username = document.getElementById("inputName").value;
var password = document.getElementById("inputPassword").value;
$.post("<?php echo site_url('Panel/login') ?>", {checkUser: username, checkPassword: password, action: "validateUser"},
function (data) {
var result = data + "";
if (result.lastIndexOf("Success" > -1)) {
$.ajax({
url: "<?php echo site_url('Dashboard/state'); ?>",
type: 'POST',
complete: function (done) {
console.log("Finished.")
}
});
}
});
}
Here Panel and Dashboard are my two different Controllers
loginclick event. Show us the entire click event code please.