JSFiddle - React, Tailwind, and code Playground
by dmethvin
HTML
<p>Successes: <span id="yea">0</span></p>
<p>Failures: <span id="nay">0</span></p>
<p>Run time: <span id="time"></span></p>
JavaScript
// ajax leak test
var start = +new Date();
var fmt = function(t){
t /= 1000;
var ss = Math.floor(t % 60),
mm = Math.floor((t % 3600) / 60),
hh = Math.floor(t / 3600);
return ""+hh+":"+mm+":"+ss;
};
var ajaxit = function(){
$.ajax({
url: "/echo/json",
type: "POST",
dataType: "json",
data: '{"milly":true,"vanilli":42}',
cache: false,
timeout: 10000,
success: function(){
$("#yea").text(+$("#yea").text()+1);
},
error: function(){
$("#nay").text(+$("#nay").text()+1);
},
complete: function(){
$("#time").text(fmt(+(new Date) - start));
}
});
};
setInterval(ajaxit, 1000);