Anyone have an idea as to why this first line of this function doesn't execute until after the ajax request is sent?
I am at a loss as to why it doesn't execute properly. If I put an alert() in there below the
line, it will execute. Very wierd.
Thanks,
LJ
LJ Wilson
My personal saying - Just remember, it can always get worse, and usually will.
Code:
function readcheck(paymentamount)
{
printchange("Insert Check into Scanner");
for (var i=0; i<=3; i++)
{
//alert("Ready to Insert Check?");
if (!workspace[ws_index].gotnewtransid)
{
getnewtransid();
}
if (workspace[ws_index].newtransid)
{
workspace[ws_index].gotnewtransid = true;
}
var request = 'type=chk&txnid=' + workspace[ws_index].newtransid +
'&amt=' + paymentamount + '&host=' + checkreader;
ajaxrequest.open("POST", micr_url + request, false);
ajaxrequest.send(null);
var response = ajaxrequest.responseXML.documentElement;
//var resp = eval(httpResponse(micr_url,'POST',request));
try
{
var scanstatus = response.getElementsByTagName('MicrStatus')[0].firstChild.nodeValue;
if (scanstatus == 'OK')
{
var chknum = response.getElementsByTagName('MicrSerial')[0].firstChild.nodeValue;
workspace[ws_index].checknumber = chknum;
//printchange("Success! <br># " + chknum );
return(true);
}
else
{
printchange("Check not read - Reinsert");
//alert("Check not read - Reinsert");
}
}
catch(err)
{
printchange("Check not read - Reinsert");
//alert("Check not read - Reinsert");
}
}
return(false);
}
I am at a loss as to why it doesn't execute properly. If I put an alert() in there below the
Code:
printchange("Insert Check into Scanner");
Thanks,
LJ
LJ Wilson
My personal saying - Just remember, it can always get worse, and usually will.