Module-documentation

version 1.0.0
module: itsa-io
maintanance: Marco Asbreuk
home
all modules

IO.get()

Get response from the server using ITSA.IO.get().

Click on the button to initiate the request.

Code-example:

<body>
    <div id="container">
        <button id="button-get">Click me get data</button>
    </div>
    <div id="target-container"></div>
</body>
<script src="itsabuild-min.js"></script>
<script>
    var url = 'http://servercors.itsa.io/example?example=1',
        container = document.getElementById('target-container'),
        writeResponse, writeResponse;

    writeResponse = function(data) {
        container.innerHTML = data;
    };

    errorResponse = function(e) {
        container.innerHTML = e.message;
    };

    ITSA.Event.after(
        'tap',
        function() {
            ITSA.IO.get(url).then(writeResponse, errorResponse);
        },
        '#button-get'
    );
</script>
API Docs