checkToken(); instance.get("users/count", { withCredentials: true }).then(function(response){ var countTable = document.querySelectorAll("#users tbody tr").length; var count = response.data / countTable; var reste = response.data % countTable; if(reste != 0){ var total = Number.parseInt(count) + 1; console.log(total); } }); instance.get("users", {withCredentials: true}).then(function(response){ console.log(response); })