ajax page move ( no refresh)

Job ID: 32170046

Budget: $10 – $30 USD

I use this code to move the page.

function acyncMovePage(url){
console.log(url)
// ajax option
var ajaxOption = {

url : url,
async : true,
type : "POST",
dataType : "html",
cache : false
};

$.ajax(ajaxOption).done(function(data){
$('.navbar-collapse').removeClass('show')
// Contents Area Delete
$('#bodyContents').children().remove();
// Contents Area Change

$('#bodyContents').load(url);
//$('#bodyContents').html(data);
});
};

and a both 1.php , 2.php
have
<script>
clearInterval(timer1);

var timer1 = setInterval(test, 1000);

function test() {

console.log('1.php');

}
</script>

<script>
clearInterval(timer2);

var timer2 = setInterval(test, 1000);

function test() {

console.log('2.php');

}
</script>

and a move 1 or 2 .php page from index
but still work setInterval in another page loaded what problem ?
Related categories: PHP JavaScript AJAX jQuery / Prototype