Stops stats from sending ajax indefinitely if the server is unreachable

Before this commit stats kept sending ajax requests without anything
stopping it from exhausting laptop batteries and CPUs, now, when the
network goes down it will stop sending requests and offer to retry
contacting the server by a bootstrap modal dialog.
added a couple of missing semicolons