javascript - 我应该使用 PHP 来实现 Schema.org 综合评分吗?
问题描述
无法处理 Schema.org 综合评级的实施。
我的代码:
<div id="page-rating">
<form id="rating-form">
<input type="hidden" name="_token" value="myToken">
<input type="hidden" name="page" value="11">
<input type="hidden" name="a" value="review">
<span class="rating-star">
<input type="radio" name="rating" value="5">
<span class="star"></span>
<input type="radio" name="rating" value="4">
<span class="star"></span>
<input type="radio" name="rating" value="3">
<span class="star"></span>
<input type="radio" name="rating" value="2">
<span class="star"></span>
<input type="radio" name="rating" value="1">
<span class="star"></span>
</span>
</form>
<div id="rating-text">Rating: <span id="rating-value">5.00</span> from 5. Count of votes: <span id="rating-count">9</span> users</div>
</div>
脚本:
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "Product",
"name": "Some Product",
"image": "path/to/image.png",
"description": "Some Description",
"brand": "Some Brand name",
"offers": {
"@type": "AggregateOffer",
"priceCurrency": "BGN",
"lowPrice": "150.00",
"offerCount": 9
},
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "5.00",
"reviewCount": "8"
}
}
</script>
好的,现在我不知道更新时要做什么?如果有人点击?
我认为必须发生的事情是在点击 .php 文件时发送 AJAX 并将新记录添加到一些数据库表(mysql)。然后在页面加载时通过 ajax 再次调用 .php 文件并获取评分 + 票数并更新 json 和 div 中的值。我对吗 ?
解决方案
推荐阅读
- sql - 需要在 SQL 中对值进行分组
- javascript - 如何更改在可排序 JQuery 中拖动的元素
- spring - Spring Boot - 映射
- r - 问题在小标题列表上进行变异和选择
- react-native - React Native Navigation 允许在部分屏幕材质顶部导航器上滑动
- azure-cosmosdb - GetItemLinqQueryable 不返回任何项目
- c - 内联汇编后指针取消引用 (SIGSEGV) 失败
- mysql - 从 3 个表中获取值到汇总表 SQL
- html - 如何使用golang连接锚标记的href属性中的变量值
- docker - Kubernetes 中部署的 Apache 气流中的 Kubernetes 执行程序和私有 Docker 映像无法正常工作