Mozilla XMLHttpRequest

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Benedikt Wismans

    #1

    Mozilla XMLHttpRequest


    Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.7) Gecko/20040630

    Dear group,

    below is a simple XML request. It works fine, the only problem is that
    Mozilla dos not quit the data transfer mode but keeps on "waiting for data
    from host..." and the Mozilla icon keeps on moving for ever. Again,
    everything works fine, but it is annoying.
    The same behaviour occurs with Mozilla 1.8 and GET/urlencoded data

    Any hint?

    thanks,
    Benedikt

    -
    var oXMLHttpRequest = new XMLHttpRequest( );
    XMLHttpRequest. open("POST", "http://"+cAPPLICATIONS ERVER+cSISSRV, false);
    oXMLHttpRequest .setRequestHead er("Content-Type","multipar t/form-data");
    oXMLHttpRequest .setRequestHead er("Content-Encoding","ISO-8859-1");
    oXMLHttpRequest .setRequestHead er("Accept","te xt/xml");
    oXMLHttpRequest .setRequestHead er("Cache-Control","no-cache");

    try {
    oXMLHttpRequest .send(this.oXML Doc);
    try {
    return oXMLHttpRequest .responseXML;
    }
    catch(e) {
    alert('Der XML-Response kann nicht interpretiert werden');
    return null;
    }
    return oXMLHttpRequest .responseXML;
    }
    catch(e) {
    alert('Der XML-Stream konnte nicht geƶffnet oder empfangen werden');
    return null;
    }



  • Martin Honnen

    #2
    Re: Mozilla XMLHttpRequest



    Benedikt Wismans wrote:
    [color=blue]
    > Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.7) Gecko/20040630[/color]

    [color=blue]
    > below is a simple XML request. It works fine, the only problem is that
    > Mozilla dos not quit the data transfer mode but keeps on "waiting for data
    > from host..." and the Mozilla icon keeps on moving for ever. Again,
    > everything works fine, but it is annoying.[/color]

    [color=blue]
    > var oXMLHttpRequest = new XMLHttpRequest( );
    > XMLHttpRequest. open("POST", "http://"+cAPPLICATIONS ERVER+cSISSRV, false);[/color]

    It seems you would want
    oXMLHttpRequest .open(...)
    and not
    XMLHttpRequest. open(...)
    [color=blue]
    > oXMLHttpRequest .setRequestHead er("Content-Type","multipar t/form-data");[/color]

    Why the Content-Type header as multipart/form-data

    [color=blue]
    > oXMLHttpRequest .send(this.oXML Doc);[/color]

    this looks more like you are sending an XML document. But that is a
    guess from your variable name.
    [color=blue]
    > return oXMLHttpRequest .responseXML;[/color]

    As for that problem does that occur with any URL you are trying to load
    or only with a particular URL or at least server?
    Have you tried asynchronous loading, e.g.
    oXMLHttpRequest .open(..., ..., true)
    together with an onreadystate handler?

    How are you calling the code above, maybe you are just lacking a return
    false or similar in an onclick handler of a link.

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/

    Comment

    Working...