JSFiddle - React, Tailwind, and code Playground

HTML

<div id="method1">.json: <span id="method1_result">No response yet</span></div>
<div id="method2">.ajax: <span id="method2_result">No response yet</span></div>

JavaScript

$.getJSON( "http://foo.com/bar.json", function() {
    $('#method1_result').html('Success');
})
.fail(function() { $('#method1_result').html('Fail'); });

 $.ajax({
     url: "http://foo.com/bar.json",
     dataType: "jsonp", 
     success: function(data) {
          $('#method2_result').html('Success'); 
     },
     error: function() {
         $('#method2_result').html('Error');
     }
 }).fail(function() { $('#method2_result').html('Fail'); });