<script type="text/javascript">
$(document).ready(function() {
$("#fun").focusout(function() {
// alert("Value: " + $("#fun").val());
$.post("<?php echo base_url() ?>index.php/login/email_exists", {
email: $("#fun").val(),
}, function(data, status) {
if (data == 0) {
document.getElementById("error").innerHTML = "Email already exists, Please select another email";
document.getElementById("ddfun").focus();
// alert("email already exists " + data);
} else {
document.getElementById("error").innerHTML = "";
}
//alert("Data: " + data);
});
});
});
</script>
I use more jQuery and Ajax in my application. I always write the Ajax(with php code) in view.php file. If there any option to add the Ajax in the external js file. Any help would be appreciated.