JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>

JavaScript

var temp = [];
$.ajax({
    type: 'GET',
    url: '',
    success: function(data) {
        $(data).each(function() {
            //do some stuff
            console.log('something'); // working
            temp.push('something');
    }).promise().done(function() {
        console.log(temp); // still empty array?!
    });
}});