Last active
May 11, 2019 02:57
-
-
Save nikolalsvk/f0f3d8141bf402b2b13ec58bc31e0ddc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- app/views/movies/show.html.erb --> | |
<div id="rating">Loading rating...</div> | |
<script> | |
const checkRating = () => { | |
fetch("<%= movie_rating_path(@movie) %>") | |
.then(response => response.text()) | |
.then(response => { | |
document.getElementById("rating").innerHTML = response; | |
}); | |
}; | |
setInterval(checkRating, 2000); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment