I have an issue on a HTML5 web app where I have repetitive data updates via an ajax query every two seconds. The first two or three go through at 175ms, but after this, they slow down to 500ms, from then on. The hosting company swears that it is not them. I did a simple test - see test scripts below. It is not my app as this test script has the same results. My question is: Is this the hosting service throttling thinking it is a DDoS attack, or is there something I can do to stop this throttling and slowing down the ajax queries?
The index file:
<!DOCTYPE html>
<html>
<head>
<script src="jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
var count = 0;
var my_timer = setInterval(function(){
$.ajax({url: "test.php", success: function(result){
$("#div1").html(result);
}});
count = count + 1;
if(count == 10) clearInterval(my_timer);
},2000);
});
});
</script>
</head>
<body>
<div id="div1">Let jQuery AJAX Change This Text</div>
<br>
<button>Get External Content</button>
</body>
</html>
The php file:
<?php
echo date('h:i:s');
?>