简体   繁体   中英

Add the IMBD rating to my web site / HTML

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.

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.

Html only determines how to display the document(ie 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM