javascript - jQuery autoload script works on localhost but fails when put on a server -


I have a page that should autoload the Instagram tag every 10 seconds. It works fine on my localhost, but fails completely on the server here it is on one. Script is killed after 10 seconds of loading the page, div contains the picture 'script.js'

  refreshId = setInterval (function () {with console content again Is written .log ("success"); $ ('# instafeed'). Load ('script.js');}, 10000); Edit: I know I said that it works with local host but I was wrong, index.html works fine if the browser is on a local server. Was not in the form of regular file. 

This is the usual behavior of that script $ ("container"). Load () will replace the contents of the 'container' by what is included in the script.

Why not writting straight js code? RefreshId = setInterval (function () {on console.log ("success"); Feed = new Instafeed ({: 'tagged', tagname: 'creative_tunnel', clientid: 'B68db303d6ac4e74ac4e2f99a3f16fd2', resolution: 'standard_resolution', range: 60,}); feed.run ();

}, 10000);

If clientid depends on an external file, you can use the code optimization and $. or $. Ajax

> to get that ID only. Otherwise to get your script working with the same system you want, you have to get the contents of script.js, then execute it with eval () ... but /! << P>

  $ ("container"). Ajax ('script.js', function (data) {// bad idea eval (data);})    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -