Javascript 当函数被调用时,PHP只返回链接中的值,这是可能的

Javascript 当函数被调用时,PHP只返回链接中的值,这是可能的,javascript,php,jquery,Javascript,Php,Jquery,目前我使用jQueryUI选项卡 <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery UI Tabs - Default functionality</title> <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoot

目前我使用jQueryUI选项卡

  <!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>jQuery UI Tabs - Default functionality</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
  <script src="//code.jquery.com/jquery-1.9.1.js"></script>
  <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css">
  <script>
  $(function() {
$('#tabs').tabs({
    beforeActivate: function (event, ui) {
        window.location.hash = ui.newPanel.selector;
    }
});

  });
  </script>
</head>
<body>

<form name="input" action="post.php" target="my_iframe1" method="post">
Summoner Name: <input type="text" name="name"><br>
Region:<select name="region">
<option value="euw">Western Europe</option>
<option value="eune">North Europe</option>
<option value="na">North America</option>
</select><br>
<input type="submit" value="Submit">
</form>

<div id="tabs">
  <ul>
    <li><a href="#tabs-1">Nunc tincidunt</a></li>
    <li><a href="#tabs-2">Proin dolor</a></li>
    <li><a href="#ranked">Aenean lacinia</a></li>
  </ul>
  <div id="tabs-1">
    <p>Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.</p>
  </div>
  <div id="tabs-2">
    <p>Morbi tincidunt, dui sit amet facilisis feugiat, odio metus gravida ante, ut pharetra massa metus id nunc. Duis scelerisque molestie turpis. Sed fringilla, massa eget luctus malesuada, metus eros molestie lectus, ut tempus eros massa ut dolor. Aenean aliquet fringilla sem. Suspendisse sed ligula in ligula suscipit aliquam. Praesent in eros vestibulum mi adipiscing adipiscing. Morbi facilisis. Curabitur ornare consequat nunc. Aenean vel metus. Ut posuere viverra nulla. Aliquam erat volutpat. Pellentesque convallis. Maecenas feugiat, tellus pellentesque pretium posuere, felis lorem euismod felis, eu ornare leo nisi vel felis. Mauris consectetur tortor et purus.</p>
  </div>
  <div id="tabs-3">
    ed nulla mattis commodo. Ut sagittis. Donec nisi lectus, feugiat porttitor, tempor ac, tempor vitae, pede. Aenean vehicula velit eu tellus interdum rutrum. Maecenas commodo. Pellentesque nec elit. Fusce in lacus. Vivamus a libero vitae lectus hendrerit hendrerit.</p>
  </div>
</div>


</body>
</html>

jQuery UI选项卡-默认功能
$(函数(){
$('#制表符')。制表符({
beforeActivate:功能(事件、用户界面){
window.location.hash=ui.newPanel.selector;
}
});
});
召唤者姓名:
地区: 西欧 北欧 北美
青蒿素、金樱子、天妇罗、金樱子a、金樱子。库拉比图尔nec arcu。我坐在阿梅特·莫里斯旁边。这是一个很好的例子。埃蒂亚姆·阿利奎特·马萨和洛雷姆。毛里斯·达比乌斯·拉库斯·奥克托·里苏斯。埃涅亚临时乌拉姆科珀狮子座。维瓦摩斯·塞德·马格纳·奎斯·利古拉·埃利弗德·阿迪皮斯。杜伊斯·奥奇。苏打水煎饼或同侧生命。阿利奎姆·努拉。我是阿利奎姆·莫莱斯蒂·埃拉特。这是一种新的葡萄品种。这是我的梦想。同侧相位。努克·特里斯蒂克·坦普斯·莱克图斯

Morbi tincidunt,我坐在医院里,看医生,看医生,看医生,看医生。杜伊斯·塞勒里克·莫莱斯蒂·图皮斯。塞德·弗林利亚,马萨·埃吉特·卢克图斯·马莱苏阿达,梅特斯·厄洛斯·莫莱斯蒂·莱克托斯,我们的厄洛斯·多洛。埃尼安·阿利奎特·弗林利亚。悬钩子在舌苔中是舌苔。在爱神的前庭里祈祷。临床医生。库拉比图尔·奥纳雷·康塞奎特·努克。埃尼安·韦尔梅特斯。乌特·波苏尔·维韦拉·努拉。阿利奎姆·埃拉特·帕特。佩伦茨克康瓦利斯。梅塞纳斯·费吉亚、佩伦特斯·普雷蒂姆·波苏尔、猫科动物奥勒姆·尤伊斯莫·费利斯、欧纳·利奥·尼西·维勒·费利斯。毛里斯·康塞德图尔·托托和珀鲁斯

埃德·努拉·马蒂斯·康莫多。Ut矢状位。Donec nisi lectus,封建者porttitor,临时ac,临时vitae,pede。这是一种交通工具。Maecenas commodo。佩伦茨克nec精英。拉库斯的福斯。维瓦摩斯是自由人,莱克图斯·亨德雷特·亨德雷特

post.php数据

//home
echo "<pre>";
echo "<h2>Summoner Info</h2>";

foreach ($str3 as $objects) {
   echo "<pre>";
   $name = $str3->name;
   $level = $str3->summonerLevel;
   $prid = $str3->profileIconId;
   $imglink = "http://lkimg.zamimg.com/shared/riot/images/profile_icons/profileIcon".$prid.".jpg";
    echo("<table border='1'><tr><th>Summoner Icon </th><th>Summoner Name </th><th>Summoner Level </th></tr>\n");
    echo("<tr><td><center><img width='32px' height='32px' src=\"$imglink\" alt=\"Cover\"></center></td><td><center>$name</center></td><td><center>$level</center></td>\n");
    echo("</table>");


   break;
}
//ranked
echo "<pre>";
echo "<h2>Ranked Stats</h2>";
foreach($str4['champions'] as $row){

    //get the values, dont really need to reassign but you get the idea
    $id = $row['id'];
    $name = $row['name'];
    $played = $row['stats']['totalSessionsPlayed'];
    $lost = $row['stats']['totalSessionsLost'];
    $won = $row['stats']['totalSessionsWon'];
    $imglink = "http://lkimg.zamimg.com/shared/riot/images/champions/".$id."_32.png";

if ($name == "Combined"){
$totalplayed = $row["stats"]["totalSessionsPlayed"];
$totallost = $row["stats"]["totalSessionsLost"];
$totalwon = $row["stats"]["totalSessionsWon"];
continue;
}
    echo("<font color='white'>");
    echo("<table  border='1'><tr><th>Champion</th><th>Games Played</th><th>Won</th><th>Lost</th></tr>\n");
    echo("<tr><td><img width='32px' height='32px' src=\"$imglink\" alt=\"Cover\"></td><td><center>$played</center></td><td><center>$won</center></td><td><center>$lost</center></td>\n");
    echo("</table>");

}
echo("<table border='1'>");
echo("<tr><th>Total Games Played</th><th>Won</th><th>Lost</th></tr>\n");
echo("<tr><td><center>$totalplayed</center></td><td><center>$totalwon</center></td><td><center>$totallost</center></td>\n");
echo("</table>");
//主页
回声“;
回声“召唤者信息”;
foreach($str3作为$objects){
回声“;
$name=$str3->name;
$level=$str3->召唤级别;
$prid=$str3->profileIconId;
$imglink=”http://lkimg.zamimg.com/shared/riot/images/profile_icons/profileIcon“$prid。”.jpg”;
回声(“召唤者图标召唤者名称召唤者级别”);
echo(“$name$level\n”);
回声(“”);
打破
}
//排名
回声“;
回声“排名统计”;
foreach($str4['champions']作为$row){
//获得价值,不需要重新分配,但你得到了想法
$id=$row['id'];
$name=$row['name'];
$played=$row['stats']['totalSessionsPlayed'];
$lost=$row['stats']['totalSessionsLost'];
$won=$row['stats']['totalSessionsWon'];
$imglink=”http://lkimg.zamimg.com/shared/riot/images/champions/“$id.”_32.png”;
如果($name==“合并”){
$totalplayed=$row[“stats”][“totalSessionPlayed”];
$totalOST=$row[“stats”][“totalSessionsLost”];
$totalwon=$row[“stats”][“totalSessionsWon”];
继续;
}
回声(“”);
echo(“ChampionGames PlayedWonLost\n”);
回声($played$won$lost\n”);
回声(“”);
}
回声(“”);
echo(“玩过的游戏总数\n”);
echo($totalplayed$totalwon$totallost\n”);
回声(“”);
因此,我要找的是在提交到post.php时隐藏选项卡,使选项卡显示,但当切换到“排名”的选项卡3时,它仅将数据拉到“排名”下,而当我切换到“主页”时,它仅使用“主页”下的数据,这可能吗

因此,它就像预加载的一样,但当您切换选项卡时,它会显示不同的数据


问候语

我会使用JavaScript事件检查用户何时提交或是否切换选项卡。既然您已经在使用jQuery,为什么不使用:$(“element”).on('change',callback)轻松地侦听这些事件呢


这将有助于减少到后端的通信数量

只需使用jquery即可。看看这个:
https://api.jquery.com/jQuery.ajax/ 
你能帮我一下吗,因为我对jquery非常缺乏经验,我对jquery非常陌生,所以我有点不知所措对不起,如果我听起来很笨