Reputation: 3
I'm using HTML to create a film review site and trying to add the IMDB rating.
I'm using this code :
<!DOCTYPE html>
<html>
<div class="rating-row" itemprop="aggregateRating" itemscope
itemtype="http://schema.org/AggregateRating">
<a class="icon" href="https://www.imdb.com/title/tt7126948/" title="IMDb
Rating" target="_blank">
<img src="https://yts.mx/assets/images/website/logo-imdb.svg" alt="IMDb Rating" />
</a>
<span itemprop="ratingValue">5.5</span>
<span itemprop="bestRating" style="display: none;">10</span>
<span itemprop="ratingCount" style="display: none;">135549</span>
<span class="hidden-xs icon-star"></span>
</div>
</html>
It gives me the IMDB logo and the rating next to it, but I don't know how to make the rating auto-refresh when its value changes on the IMDB website.
In the code I put the value 5.5 manually. Is there a way to automize the process?
PS: I'm new to HTML, I just started using it.
Upvotes: 0
Views: 686
Reputation: 9
Html only determines how to display the document(i.e on Browser). You have to use an asynchronous development environment to Auto-Reload the value on change. Even JS is synchronous(means that only one operation can be in progress at a time), so you have to use AJAX to make JS asynchronous(to call ). Only with HTML, you can't make the Page content Auto-Refresh. And Yes there are multiple ways by which You can Automize this process but you have to use Asynchronous technology. You should refer to this for understanding Asynchronous
Upvotes: -1
Reputation: 104
You can't automatize it using only HTML, you will need to use PHP or Javascript (AJAX) and request directly to the IMDB website API. So whenever you're accessing the webpage you ask to the website What is the rating ? the IMDB API send you the current rating and you display the value into your HTML.
Upvotes: -1