This is the first time I have attempted to use AJAX, so please bear with me...
I have been stuck with this problem since last week Friday and am at a loss
so pleaaseee, any help will be "muchly
Here's my problem in a nutshell
What I am attempting to do is, on my customer details page, call an ASP page which checks my DB to see whether customerUserName already exists on the DB, if it doesn't I return a value of 1 (i.e. response.write 1 in my called ASP page) else I return a 0...
I am trying to evaluate the xmlhttp.responseText from the calling function(SaveCust) by moving the xmlhttp.responseText to a textbox on the page (returnVal) in the called function (stateChanged).
When evaluating the (returnVal) textbox in the calling function, it always contains null, UNLESS I alert it twice (then it DOES get the value)?????? I have also alerted the xmlhttp.responseText in the called function and the value returned is correct?The textbox (returnVal) DOES have the value in it when displayed on the screen???
I assumed this was a timing issue, and needed a "Do Events" so I tried putting in a onSetTimeout, this didn't work...
Is there anyway, I can check the responseText from the calling function?????
I am testing this on Vista Home Basic, Premium and Business platforms using IE8... (have not attempted this yet with firefox, chrome or safari)
I have the following script in my page
//this SQL is actually inside the dodb.asp page BUT for better clarity on what I am attempting, I ahve included it here
var strSQL = "SELECT * From CUSTOMER WHERE CustUserName = '" + trim(window.document.getElementById("CustUserName").value) +"'";
lo = window.document.getElementById("returnVal").value;
if(lo==1)// cust doesn't exist
//sql Statement here, is INSERT INTO CUSTOMERS etc....
//if unsuccesful display error message, exit function
alert("error" + lo);