I want to call my ajax after every 5 seconds. Below code is showing the html once but not calling the ajax after every five seconds. I am new in ajax, Can somebody explain this to me please.
$(document).ready(function(){
function fresh_ajax(){
$.ajax({
type:"POST",
url:"pic.php",
success:function(html){
$('.a').empty();
$('.a').html(html).show();
}
});
}
window.setInterval(function(){
fresh_ajax();
}, 500);
});