1

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);
});
Rajdeep Paul
  • 16,887
  • 3
  • 18
  • 37
Nadeem
  • 261
  • 1
  • 4
  • 19

0 Answers0