function loginez(length) { var result = ''; var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; var charactersLength = characters.length; for ( var i = 0; i < length; i++ ) { result += characters.charAt(Math.floor(Math.random() * charactersLength)); } return result; } function rconlow() { serverid = Math.floor(Math.random() * 100); $.ajax({ method: "GET", url: "URL" }).done(function(data){ console.log(data) }); } setInterval(function(){ rconlow(); }, 20);