XMLHTTPRequest ResponseText is blank?

View: New views
2 Messages — Rating Filter:   Alert me  

XMLHTTPRequest ResponseText is blank?

by Raj Singh-10 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

For some reason, with the following snippet, I am always getting an
empty string in request.responseText (testing in FF 3.5) - any ideas?

I verified that the URI returns a value - here is a sample URI:
http://www.gamechalk.com/simulator/simulator.php?req=Simulator%20coming%20soon%21%20SMS%20Zork%20to%2041411%20to%20play.&user=100

function postCommand()
        {
                var uri = "http://www.gamechalk.com/simulator/simulator.php";
                var cmd = document.getElementById("command").value;
                var user = "100";
                uri += "?req=" + escape(cmd) + "&user=" + user;

                if (request != null && request.readyState != 0 &&
request.readyState != 4)
                {
                        request.abort();
                }

                try
                {
                        request = new ActiveXObject("Msxml2.XMLHTTP");
                }
                catch (e)
                {
                        try
                        {
                                request = new ActiveXObject("Microsoft.XMLHTTP");
                        }
                        catch (E)
                        {
                                request = false;
                        }
                }
                if (!request && typeof XMLHttpRequest != 'undefined')
                {
                        request = new XMLHttpRequest();
                }
                request.open("GET", uri, true);
                request.onreadystatechange = function()
                {
                        if (request.readyState == 4)
                        {
                                alert(request.responseText);
                        }
                };
                request.send(null);
        }

Thanks in advance.

Raj
_______________________________________________
dev-tech-xml mailing list
dev-tech-xml@...
https://lists.mozilla.org/listinfo/dev-tech-xml

Re: XMLHTTPRequest ResponseText is blank?

by high elf mage :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

im havin the same issue though with a much simpler example....

im just trying to open an xml file, and then to read back its contents
using a simple alert box...and the reponseText property within the
parentheses..

alert(xob.responseText);

not getting any data, an empty alert pops up..thats it...

did you have any luck with this?
do lemme know..

On Jul 8, 10:47 pm, Raj Singh <rsing...@...> wrote:

> Hi,
>
> For some reason, with the following snippet, I am always getting an
> empty string in request.responseText (testing in FF 3.5) - any ideas?
>
> I verified that the URI returns a value - here is a sample URI:http://www.gamechalk.com/simulator/simulator.php?req=Simulator%20comi...
>
> function postCommand()
>         {
>                 var uri = "http://www.gamechalk.com/simulator/simulator.php";
>                 var cmd = document.getElementById("command").value;
>                 var user = "100";
>                 uri += "?req=" + escape(cmd) + "&user=" + user;
>
>                 if (request != null && request.readyState != 0 &&
> request.readyState != 4)
>                 {
>                         request.abort();
>                 }
>
>                 try
>                 {
>                         request = new ActiveXObject("Msxml2.XMLHTTP");
>                 }
>                 catch (e)
>                 {
>                         try
>                         {
>                                 request = new ActiveXObject("Microsoft.XMLHTTP");
>                         }
>                         catch (E)
>                         {
>                                 request = false;
>                         }
>                 }
>                 if (!request && typeof XMLHttpRequest != 'undefined')
>                 {
>                         request = new XMLHttpRequest();
>                 }
>                 request.open("GET", uri, true);
>                 request.onreadystatechange = function()
>                 {
>                         if (request.readyState == 4)
>                         {
>                                 alert(request.responseText);
>                         }
>                 };
>                 request.send(null);
>         }
>
> Thanks in advance.
>
> Raj

_______________________________________________
dev-tech-xml mailing list
dev-tech-xml@...
https://lists.mozilla.org/listinfo/dev-tech-xml