Cannot get this to refresh. My code is below. I am propably doing something silly, but I cannot figure it out...

var auto_refresh = setInterval(
 function(e) { 
 var email = '<?php echo $_SESSION['user_email']?>';
 console.log(email);
  e.preventDefault();
   $.ajax({
      type : 'GET',
       url : 'count_record.php', // in here you should put your query 
      data :  'email='+ email, // here you pass your id via ajax .
                 // in php you should use $_POST['post_id'] to get this value 
      success : function(r){

          // now you can show output in your modal 
          $('#messages1').load(r).fadeIn("slow"); 
 }:15000);
 }
});

Hi,
im assuming this is javascript and not php.
Second, do you want to call a function every xx minutes via ajax? If so, just set the interval and call the function in it.

setInterval(ajaxCall, 300000); //300000 MS == 5 minutes

function ajaxCall() {
    //do your AJAX stuff here
}

or delete line 16 since its an extra bracket and move the miliseconds to line 17 between the parenthesis and bracket
}, 15000);

post back and let us know.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.