0

Do you know if there is a solution for livereload function properly? Because for one week, it no longer works, or almost: (

The refresh occurs after 6s, it's very long, too long. Before, I had an error message about a js file, it was pretty weird.

Do you have a solution or an alternative to livereload?

Thank you to you :)

Stéphane
  • 23
  • 4

2 Answers2

0
setInterval(yourFunction, timeout) 

timeout in ms

Satpal
  • 132,252
  • 13
  • 159
  • 168
Anon
  • 2,854
  • 14
  • 18
0

Yes, there is one solution. Ajax.

Edited

http://api.jquery.com/jQuery.ajax/

This will run some code every 6s. Just store this code to the head of document.

var timer = null;
function loader(){
    if (timer) {
        clearTimeout(timer);
        timer = null;
        return;
    }
    timer = window.setInterval(function(){
      // DO SOME CODE
    }, 6000);
}

window.onload = function() {
    loader();
};

Demo: http://jsfiddle.net/FK452/1/

And this will load page boo.php to <div id="content"> </div>. You can access var json from boo.php by $_POST -> $_POST['json'], $_POST['second']:

$.post('boo.php', {json: "value", second: "val"}, function(html){
  $("#content").html(html);
});
m1k1o
  • 2,344
  • 16
  • 27