Hello guys i have a big doubt....
In my javscript code i need to reload a js file (where there's a multidimensional array) every 1 minutes.
To reload it suggest me to use ajax
or another way ?
Example A:
try {
jQuery.ajax({
url: "http://www.fake.con/scripts/out/array/week-quakes.js",
dataType: "script",
cache: false
});
}
catch(e){
var aggiungi= '<span>there's error about server</span>';
$(aggiungi).appendTo('#lista-eq');
}
Example B
$("head script[src='http://www.fake.con/scripts/out/array/week-quakes.js']").remove();
$('head').append('<script type="text/javascript" src="http://www.fake.con/scripts/out/array/week-quakes.js"><\/script>');
These codes are inside setInterval(function())
However my problem is also that when i realod js file is possible it isn't ready or doesn't exist, so how can i solve this problem ?
I hope can you help me and suggest good :)