更新 AJAX 成功函数的下拉列表

问题描述

我有一个下拉列表,我可以在其中选择联赛,还有另一个下拉列表,其中包含根据第一个下拉列表中选择的联赛的球队。我的问题是在 AJAX 调用的成功函数中包含哪些内容以使用所选联赛更新下拉列表。任何人都可以帮助我实现这一目标。谢谢

PHP 数据库查询 / view_fixtures_queries.PHP

Listening on http://127.0.0.1:7038
Warning: Error in value[[3L]]: Couldn't normalize path in `addResourcePath`,with arguments: `prefix` = 'PopupTable-0.0.1'; `directoryPath` = ''
  [No stack trace available]

在团队下拉列表中获取团队

$league = '';

if(isset($_POST['selected'])):
   $league = $_POST['selected'];
endif;

$home_team = $dbh->prepare("SELECT * FROM teams WHERE competition = :league");

echo "<script>console.log($league)</script>";

$home_team->execute([ ':league' => $league ]);

$data  = $home_team->fetchAll();

print_r($data);

AJAX 调用发送所选联赛

<?PHP
   while ($row = $home_team->fetchAll()) 
   {
       $hometeamlogo = $row['logo'];
       $hometeamstadium = $row['stadium'];
       echo "<option value='data:image/png;base64,".base64_encode( $hometeamlogo )."' data-stadium='$hometeamstadium'>" . $row['team_name'] . "</option>";
   }
?>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)