[thelist] XMLHTTPRequest

Michael Pemberton mpember at phreaker.net
Thu Jul 19 11:46:28 CDT 2001


Hi.

Just a quick post to see if there is anyone out there who knows how I
can use the XMLHTTPRequest object (mozilla 0.9+) to POST data.

I have check all the Mozilla docs but it look like I need to be sending
a DomDocument object.  Here is the code I currently have.

    FileIO.XMLObject=new XMLHttpRequest();
    FileIO._readURLData=function(url,data) {
        var method=data==null ? "GET" : "POST";
        FileIO.XMLObject.open(method, url, false);
        FileIO.XMLObject.send(data||"");
        return new
String(FileIO.XMLObject.responseText||"").replace(/\r/,'');
    };

If there is any way that I can somehow create a DomDocument object based
on the data I need to trasmit, that would be of great help.  The mozilla
documentation makes reference to the following method:

(http://unstable.elemental.com/mozilla/build/latest/mozilla/extensions/dox/class_nsIDOMParser.html#a1)

    nsIDOMDocument nsIDOMParser::parseFromString (  in wstring str, in
string contentType )

I have no idea if this can be used from within JS, it appears not.

And now, to pay for my post, here's a tip : )

<tip type="Applets VS Liveconnect in NS" author="Michael Pemberton">
Even though both are aparently the same (security and restrictions
should be the same).  They are not.
It is possible that something that is not possible using the Java
objects directly in LiveConnect may be allowed when being used in an
applet.

eg. a URLConnection can't POST data if it is created using LiveConnect.
The same code in an applet is allowed.

It is always best to experiment with the altenatives to see what is
allowed in the two methods.
</tip>
--
Michael Pemberton
mpember at phreaker.net
ICQ: 12107010






More information about the thelist mailing list