0

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);
 }
});
2
Contributors
1
Reply
30
Views
5 Months
Discussion Span
Last Post by michael.dewitt.716
1

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.

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.