ページタイトルを更新しました。
これは Leaderboard.php にあります。現在、tbody に PHP 呼び出しがあることがわかります。
<!-- The Leaderboard Table -->
<table id="tblData" class="table table-hover leaderboard-table target">
<thead>
<tr>
<th class="hidden-phone">Rank</th>
<th>Sales Person</th>
<th>Total Points</th>
</tr>
</thead>
<tbody id="leaderboardresults">
<?php $getLeaderboard->getTable($_GET['competitionId']); ?>
</tbody>
</table>
<!-- The Leaderboard Table END -->
これは API/getLeaderboard.php にあります。これは getTable 関数がある場所です。
<?php
class getLeaderboard {
public function getTable($competitionId) {
//I run the SQL query and echo out some PHP
}
これは Leaderboard.php にあります。
function loadLeaderboard() {
var competitionId = $("body").attr("data-competitionId");
var url = "api/getLeaderboard.php?competitionId=" + competitionId;
$.get(url, function(data) {
//$("#leaderboardresults").html(data);
});
}
これは Leaderboard.php にもあります。AJAX get を実行する別の AJAX 呼び出し (これは完全に機能します) で、成功するとリーダーボードをリロードする必要があります。
$(function() {
//this works (/James)
$(".navVisible").click(function() {
var Competition = $("body").attr("data-competitionId");
var Activity = $(this).attr("data-activity");
$.post("registerresults.php", { data: Activity, competitionId: Competition })
.done(function(data) {
loadLeaderboard();
});
});
loadLeaderboard();
});
これは getLeaderboardTable.php です
<?php
include "common/common.php";
include "api/getLeaderboard.php";
$competitionId = $_GET['competitionId'];
$getLeaderboard->getTable($competitionId);
?>