wowenkho wrote:meh no wonder. you can't get it by alerting that way. you need to WAIT for the response to get back before you can actually alert and expect a value. i'm not sure what exactly but i know the Ajax class should have something like an onComplete or onSuccess event method. you can do your req.transport.responseText there.
i had tried to call onComplete function , still not work on google chrome for
synchronous -
- url = 'index.php?option=com_fsite';
- var req = new Ajax(url, {
- method:'POST',
- async:false,
- data:'&format=raw&task=getok&captcha_work='+josfm.captcha_work.value ,
- onComplete : function (ans){
- alert(ans='+ans);
- }
- }).request();
-
-
and call a simple function following as :
-
-
- if ( window.XMLHttpRequest ){
- req = new XMLHttpRequest();
- } else if ( window.ActiveXObject() ) {
- req = new ActiveXObject("Microsoft.XMLHTTP");
- }
- req.open("GET", url, false);
- req.send(null);
- if (req.status == 200) {
- alert('req.responseText='+req.responseText);
- } else {
- alert("There was a problem retrieving the XML data:\n" + req.statusText);
- };
-
or
-
- req.onreadystatechange=funciton(){
- if (req.status == 200) {
- alert('req.responseText='+req.responseText);
- } else {
- alert("There was a problem retrieving the XML data:\n" + req.statusText);
- }
- };
- req.open("GET", url, false);
- req.send(null);
-
still not work on google chrome
so , synchronous can not correct work on google chrome ??