Hi thank you fot timp it's working but i've allready done that the problem is if you notest this is a funtion witch is called by another funtion and in the first call it returns me that the var "my var " is undefined but if click ok on alert and press enter again (means try again) it returns me the good number
how can i put it not to bee undefined ?it's important because tis is an interfation with client and for every client i have to hit twice enter ill give you the funtion again
function SumaCorectaDePariere()
{
NumarMeciuri();
GetSuma();
if ( (miza<1) ) { alert("Miza trebuie sa fie mai mare decat 1 RON"); return true;}
if ( (miza>3) ) {
http=getHTTPObject();
http.open("GET",link_ajax+"verific_miza.php?miza=" +miza, true);
http.onreadystatechange = function() {
if (http.readyState == 4) {
var textout = http.responseText;
var vad=textout.split(":");
verde=vad[1];
//if ( ((vad[0]=="peste")) && ( (vad2 <= 200) )) { alert("Miza trebuie sa fie mai mica decat "+vad[1]+" va rog cereti aprobare la sediu!!!"); return true;}
}
}
http.send(null);
}
var vad2=parseFloat(verde);
if ( ( miza> vad2 ) ) { alert("Miza mai mare de:"+ vad2+" RON nu este permisa "); return true;}
return false;
}
i'm thinking of writing my var "verde" into a div somewhere and then read that div do what i supose to do
With regard to responseText, I am executing a php script via an xmlhttprequest, and up until now when I ran this code
[
-
response = http.responseText;
-
alert(response);
-
all I was getting was the php code from the script. I realised that the script was not getting executed by the request. Today I moved all my files to another folder, now when I execute this code I confirmed that the script did execute and I got the results I wanted within the alert. Now I am trying to get this info out of responseText. I have tried all of these
-
split()/eval()
-
var variable = getElementByID/Name('variable');
-
and getting the same result everytime
"object doesn't support this property or method"
I am not using XML.
Can anyone help me with this?
rpjd