我需要从以下位置获取ID号:
<div class="social" th:data-url="@{http://localhost:8080/poll?id=${poll.pollId}" data-title="">
但是这不起作用。我该怎么办?
希望这会有所帮助。
//get value of 'this' element that was clicked
var url = $(this).attr('data-url');
// split string and get value of id
var splitted = url.split("id=");
console.log("Id:"+splitted[1]);