using nodejs and express I'm trying to trigger a js function which contains a simple console log. Sadly the function only triggers 6 times and freezes for a while. After a minute or two all the button clicks which where clicked during the "frozen time" triggers at once. It happens always after 6 times of pressing a button.
index.html -> button
client side -> jquery function that triggers an Ajax post function
server.js -> contains the express function which triggers the console log
index.html
<input type="button" id="car" value="drive"/>
clientside.js
$('#car').click(function(){
$.ajax({
type:'POST',
url: url + '/drive'
});
});
server.js
var app = express();
app.post('/drive', function(req, res){
console.log('Car starts driving');
});
What am I doing wrong? Any tips how I can improve my code?
Thank You