I have a jquery script, that running ajax script every 2 second
javascript:
function getvalue(){
$.ajax({
url: "http://localhost:3000/companies/#{@company.url}",
type: "GET",
dataType: "json",
success: function (json) {
$('.blabla').html(json.clicks);
$('.tratata').html(json.shows);
}
});
}
javascript:
$(document).ready(function(){
getvalue();
setInterval('getvalue()', 2000);
});
and when I trying to move this script in assets, and call him via javascript_include_tag
- then it starts to work throughout the application, not only in the view where I call him.
how fix?
upd
I put this script in to app/assets/javascripts/foobar.js, and call him in view this
= javascript_include_tag 'foobar'