I want to change the content of the p tag after three seconds using setInterval()
method. Then after three seconds I want to change the content inside of the p
tag, with a new interval of 5 seconds. This is my code snippet:
background.js
var notify;
var word=function(){
$.get("http://localhost/chrome-notification/dosya.php", function (data) {
$('#container').html(data);
});
};
setInterval(word,3000);
setInterval(function(){
$.get("http://localhost/chrome-notification/", function (response) {
notify=$(response).getElementsByTagName('p')[0].innerHTML;
});
},5000);
index.html
<html lang="en">
<head>
<meta charset="UTF-8">
<script language="JavaScript" type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="background.js"></script>
<title>Vocabulary</title>
</head>
<body>
<p id="container">
</p>
</body>
</html>