在html函数括号写入参数即可
<button onclick="Up('{{ i.SiteLabel }}')" type="button">点赞</button>
<script type="text/javascript">
function Up(label) {
$.ajax({
url: '/Up/',
type:'POST',
data:{'label':label},
success:function (data) {
console.log(data)
alert(label)
},
error:function (data) {
},
})
}
</script>
<script src="{% static 'assets/vendor/jquery/jquery.min.js' %}"></script>