JSFiddle - React, Tailwind, and code Playground

by Sivasakthi Chandrasekaran

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({
            type: 'post',
            url: 'https://nfrel.herokuapp.com/api/v1/push_services/submit?',
            data: {  chain_id:'70',username:'shin%40dailygobble.com',point:'1',service_type:'1',minute:'01',year:'2016',month:'12',hour:'01',select_type:'manual_enter',access_token:'NM4XComvqg6hAOMP4X%2F4Brbfp5an70%2BQVLkkd3mGjk0%3D',user_ids:'350427',day:'02',time_zone_default:'EST'
            },
contentType: 'application/json; charset=utf-8',
            beforeSend: function() {
                console.log('Fired prior to the request');
            },
            success: function(data) {
                console.log('Fired when the request is successfull');
                $('.document').append(data);
            },
            complete: function() {
                console.log('Fired when the request is complete');
            }
        });

    });

});