JSFiddle - React, Tailwind, and code Playground

by nicolas tenorio

HTML

<div class="document">
<a class="ajax" href="#">Fire an AJAX request</a>
</div>

JavaScript

$(function() {

    $('.document').on('click', '.ajax', function(e) {
        e.preventDefault();

        // ajax request
        $.ajax({
            async: true,
            cache: false,
            method: 'get',
            url: 'http://wsmio.siur.com.co:8083/apiMIO/jaxrs/pevrs',
            data: {
                html: '<p>This is echoed the response in HTML format</p>'
            },
            dataType: 'html',
            beforeSend: function() {
                console.log('Fired prior to the request');
            },
            success: function(data) {
                console.log('Fired when the request is successfull');
                $('.document').append(data.html);
            },
            complete: function() {
                console.log('Fired when the request is complete');
            }
        });

    });

});