JSFiddle - React, Tailwind, and code Playground

by Pankaj Parkar

JavaScript

$.ajax({
  xhr: function()
  {
    var xhr = new window.XMLHttpRequest();
    //Download progress
    xhr.addEventListener("progress", function(evt){
    debugger
      if (evt.lengthComputable) {
        var percentComplete = evt.loaded / evt.total;
        //Do something with download progress
        console.log("down", percentComplete);
      }else{
        // the way jsFiddle's ajax echo service works the length
        // is not computable, so just adding this here:
        console.log("down 234234", evt.loaded / 600000);
      }
    }, false);
    return xhr;
  },
  headers: {
  	'Access-Control-Request-Headers': 'origin, content-type'
  },
  type: 'GET',
  url: "http://dummy.restapiexample.com/api/v1/employees",
  //url: "http://download.cdn.mozilla.net/pub/mozilla.org/firefox/releases/22.0/win32/rm/Firefox%20Setup%2022.0.exe"
});