Slider run in offline/localhost but not run in online/server <p>I write a JavaScript code for slider. This code run in localhost or offline. But it is not run in online or my server. I use this code. please help me. I try but not solve it. where is my wrong?</p> <pre><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; var imagecount=1; var total=5; function slide(x){ var Image = document.getElementById('img'); imagecount = imagecount + x; if(imagecount &gt; total) { imagecount=1; } if (imagecount &lt; 1) { imagecount = total; } Image.src = "img/image" + imagecount + ".jpg"; } window.setInterval(function slideA(){ var Image = document.getElementById('img'); imagecount = imagecount + 1; if(imagecount &gt; total) { imagecount=1; } if (imagecount &lt; 1) { imagecount = total; } Image.src = "img/image" + imagecount + ".jpg"; },5000); &lt;/script&gt; </code></pre>