CODE:
<script>
function ckID(taid, callback) {
return $.ajax({
url: 'myscriptfile.cfm?taid='+taid,
/*
data : { // Sorry I missed the colon !
id: id
},
*/
success: callback
});
}
ckID('',function(rtn) {
console.log(rtn);
if (rtn > 0) {
// record already exists
// alert
document.getElementById('custNoDupe').innerHTML = "<font color='red'>This ID already exists in the database</font>";
// reset current input to nothing
document.getElementById('taid').value = "";
}
});
</script>
</head>
<body>
<form>
Enter customer ID: <input type="text" size="15" id="taid" onMouseOut="ckID(document.getElementById('taid').value);"> <span id="custNoDupe"></span> <br/>
Enter customer name: <input type="text" size="15">
</form>
</body>
</html>
ADDITIONAL INFO:
rtn will always return either 0 or 1
RESULT:
ckID('',function(rtn) {}
does not seem to have been executed
Observation:
URL with parameter call seems successful from debugging output
How to fix it? Thanks.