[英]How can i add AJAX in my php wordpress plugin
我想在我的 WordPress 插件中添加 AJAX,這樣頁面就不必完全重新加載。 我只想加載顯示此插件的頁面部分
function trackingplugin_print_table()
{
if (!$_POST[track_number]) {
return;
}
$url = "url here";
$code = $_POST[track_number];
$data = file_get_contents("$url$code");
$json = json_decode($data);
echo "<table class=\"table\">";
foreach ($json as $key => $row) {
echo "<tr>";
foreach ($row as $key0 => $row0) {
echo "<th>" . $key0 . " : " . $row0 . "</th>";
}
echo "</tr>";
}
echo "</table>";
}
?>
我想在我的 WordPress 插件中添加 AJAX,這樣頁面就不必完全重新加載。 我只想加載顯示此插件的頁面部分
function trackingplugin_print_table()
{
if (!$_POST[track_number]) {
return;
}
$url = "url here";
$code = $_POST[track_number];
$data = file_get_contents("$url$code");
$json = json_decode($data);
echo "<table class=\"table\">";
foreach ($json as $key => $row) {
echo "<tr>";
foreach ($row as $key0 => $row0) {
echo "<th>" . $key0 . " : " . $row0 . "</th>";
}
echo "</tr>";
}
echo "</table>";
}
?>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.