JSFiddle - React, Tailwind, and code Playground

by Matt Ball

JavaScript

var count = 0;

function onSuccess () {
    count++;
}

function callback (data) {
    console.log(data);
}
    
function showData() {
    alert(count);
}

function method1() {
    return $.ajax('http://jsfiddle.net/echo/jsonp/', {
        dataType: 'jsonp',
        //jsonp: '$callback',
        success: onSuccess
    });
}

function method2() {
    return $.ajax('http://jsfiddle.net/echo/jsonp/', {
        dataType: 'jsonp',
        //jsonp: '$callback',
        success: onSuccess
    });
}

$.when(method1(), method2()).then(showData);