Nisha .A
Nisha .A

Reputation: 46

Auto refresh the div in jquery and php

This is my code,

<script type="text/javascript">
var refreshId = setInterval(function () {
var pathtopage = window.location.href;
$('#refreshing').load(pathtopage + '#refreshing');
},2000);
</script>

When i run the code,i got error like this

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience.

How to rectify the error

Upvotes: 0

Views: 45

Answers (1)

codebased
codebased

Reputation: 7073

Not sure what you are doing with window.location.href, but this how you should be doing, where you are calling an end point that returns you something ... his would do the job.

 $(function() {
        start();
    });

    function start() {
        setTimeout(start,2000);
        $.get(pathtopage, function(data) {
            $('#refreshing').html(data);    
        });
    }

Upvotes: 2

Related Questions