databinding-$8.lzx

<canvas width="100%" height="600" debug="true">
  <include href="rpc/ajax.lzx"/>
  <script>
    
    
    var req = null;

    function processReqChange() {
        Debug.debug("processReqChange: req.readyState %w", req.readyState);
        // only if req shows "loaded"
        if (req.readyState == 4) {
            // only if "OK"
            if (req.status == 200) {
                Debug.debug("req.status %w", req.status);
                Debug.debug("req.responseText: %w", req.responseText);
                Debug.debug("req.responseXML: %w", req.responseXML);
                Debug.debug("req.getAllResponseHeaders: %w", req.getAllResponseHeaders());
            } else {
                Debug.error("There was a problem retrieving the XML data: %w",
                            req.statusText);
            }
        }
    } 
    function loadXMLDoc(url) {
        // branch for native XMLHttpRequest object
        req = new lz.XMLHttpRequest();
        req.onreadystatechange = processReqChange;
        req.open("GET", url, true);
        req.setRequestHeader('X-Test', 'one');
        req.setRequestHeader('X-Test', 'two');
        req.send(null);
    }
    
  </script>
    <simplelayout spacing="4"/>
    <edittext id="in1">example.xml</edittext>
    <button onclick="loadXMLDoc(in1.text)">Load Data</button>
    <button onclick="loadXMLDoc('badurl')">Test Error Handling, this should fail</button>
</canvas>
<!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
* Copyright 2007, 2008-2011 Laszlo Systems, Inc.  All Rights Reserved.             *
* Use is subject to license terms.                                            *
* X_LZ_COPYRIGHT_END ****************************************************** -->

Cross References

Includes

Named Instances