JSFiddle - React, Tailwind, and code Playground

by mayooresan

HTML

<input id='xhr_url' style='width:600px;' type='text' value='http://t2json.tgoservices.com/818746/PrinterManufacturers'/>

  <button id='request_content'>Request content</button>
  <fieldset><legend>Time:</legend>
    <div id='time'></div>
  </fieldset>
  <fieldset><legend>Status:</legend>  
    <div id='status'></div>
  </fieldset>
  <fieldset><legend>Content:</legend>

    <div id='content'></div>
  </fieldset>

JavaScript

$('#time').html(new Date);
    $('#status').html('');
    $('#content').html('');
    var id = '';
    $.ajax({
      cache: false,
      url: $('#xhr_url').val()
    }).done(function(data, textStatus, jqXHR) { 
    //alert(data);     
      $('#status').html(textStatus);
      $('#content').html(JSON.stringify(data));

     var jsonp = JSON.stringify(data);
     var obj = $.parseJSON(jsonp);
      $.each(obj, function() {
      //alert("hi");
          id += this['Id'] + "<br/>";
          $('#content').html(id);
      });
      //$('#content').html(lang);
    }).fail(function(jqXHR, textStatus) {
      $('#status').html(textStatus);    
      $('#content').html('(failed)');
    })