我有一个小项目。在这个项目上。我有包含足球联赛名称的表格。桌子上的所有都是链接。单击这些链接之一时,我需要将我的页面定向到相关的排行榜。例如;
如果我从我的表中点击了英超联赛,我需要将我的页面指向英超联赛表页面。
我写了小代码,但没有用。
$(function() {
var tableRow = $("td").filter(function() {
return $(this).text() == "Premier League";
})
window.location.href = "RELATEDURL";
});
有人可以帮我吗?谢谢你。
编辑1:我用这种方法得到联赛的名字。我需要申请这种格式。
$(document).ready(function() {
$.getJSON("getleaguetablesURL",function(data) {
console.log(data);
$.each(data, function(index, value) {
$('#leaguetable').append("<tr><td class='team'><a href='#'>"
+value.Name+"</a></td></tr>");
});
$('#leaguetable').listview('refresh');
})
});