I want to call ajax function at specified intervals after enterkey being pressed. However, the code doesn't work. I want to get some advice. Thank you!
function regist(){
$.ajax({
url: '/getlabel',
method: 'GET'
}).done(function(r){
// console.log(r);
$('#label').text(r)
console.log("ajax-success")
}).fail(function(){
console.log("ajax fail")
});
}
function keyPress(e) {
if (e.keyCode == 13) {
setInterval( regist() , 3000);
return false;
}
}