[英]How can i add AJAX in my php wordpress plugin
I want to add AJAX in my WordPress plugin so the page doesn't have to reload entirely.我想在我的 WordPress 插件中添加 AJAX,这样页面就不必完全重新加载。 I just want only the part of the page that shows this plugin to load我只想加载显示此插件的页面部分
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>";
}
?>
I want to add AJAX in my WordPress plugin so the page doesn't have to reload entirely.我想在我的 WordPress 插件中添加 AJAX,这样页面就不必完全重新加载。 I just want only the part of the page that shows this plugin to load我只想加载显示此插件的页面部分
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.