So, the basics of what I'm attempting to accomplish, is the user submits a form, using AJAX, it's updated, and a row is added to the table. Works great in all browsers, Microsoft's piece of crap included.
After the form is submitted, and the table is updated, a balance that is elsewhere on the page needs to also be updated. It's basically kinda like a bank register. Add a transaction, the balance is automatically calculated. So, I have this code:
updateBalance() is called from the function that submits the stuff to the PHP script to be added to the DB. openAjax() returns an XMLHTTPRequest (and the IE equivalent). Ajax.php calculates the new balance and does nothing else but print out the balance formatted with currency symbol and decimals, and this is captured by reqBal.responseText, as you would expect. This code works perfectly in all Mac browsers. So, I fire up my PC, launch IE and test. The very first time the balance needs to be updated, it works. After that, IE refuses to change the value of responseText next time the function is called....it's basically stuck on the first value it gets when it's first called. Any future calls it ignores and thus, the balance doesn't update. The only way to make it take a new value is to completely close all of IE's windows, open it back up and do it again. It will get a new value, then get stuck on that.
So, can someone tell me what I screwed up, or some other obnoxious, lengthy, complicated work around to make IE work as it should? Because right now, if IE had them, I'd kick it square in the balls. Thanks
After the form is submitted, and the table is updated, a balance that is elsewhere on the page needs to also be updated. It's basically kinda like a bank register. Add a transaction, the balance is automatically calculated. So, I have this code:
Code:
function updateBalance(account) {
reqBal = openAjax();
var url = "ajax.php?act=balance&id="+account;
reqBal.open("get", url, true);
reqBal.onreadystatechange = handleBalance;
reqBal.send('null');
}
function handleBalance() {
if(reqBal.readyState == 4){
alert(reqBal.responseText);
document.getElementById('balspan').innerHTML = reqBal.responseText;
}
}
updateBalance() is called from the function that submits the stuff to the PHP script to be added to the DB. openAjax() returns an XMLHTTPRequest (and the IE equivalent). Ajax.php calculates the new balance and does nothing else but print out the balance formatted with currency symbol and decimals, and this is captured by reqBal.responseText, as you would expect. This code works perfectly in all Mac browsers. So, I fire up my PC, launch IE and test. The very first time the balance needs to be updated, it works. After that, IE refuses to change the value of responseText next time the function is called....it's basically stuck on the first value it gets when it's first called. Any future calls it ignores and thus, the balance doesn't update. The only way to make it take a new value is to completely close all of IE's windows, open it back up and do it again. It will get a new value, then get stuck on that.
So, can someone tell me what I screwed up, or some other obnoxious, lengthy, complicated work around to make IE work as it should? Because right now, if IE had them, I'd kick it square in the balls. Thanks