按下同一页面上的按钮后加载php [英] loading php after pressing a button on same page
本文介绍了按下同一页面上的按钮后加载php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<!DOCTYPE html>
<html>
<head>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'></script>
<script>
$(document).ready(function(){
$('.myButton').click(function() {
var $ct = $(this).next("div.container");
if (this.value == 'collapse') {
this.value = 'expand';
$ct.hide("slow");
$('.myButton').parent().show("slow");
} else {
this.value = 'collapse';
$ct.show("slow");
$('.myButton').not($(this)).parent().hide("hide");
}
});
});
</script>
</head>
<body>
<?php
for($i=0;$i<=3;$i++)
{
echo"<div class='main' style='removed:relative;border:1px solid #A5BEBE;background- color:#E7EFEF;width:84%; '>
sometext:-<a href='#'>$url</a><br>
sometext :$b<br>
</p>
<input type='button' value='expand' class='myButton' name='button1' target='".$i."' onclick='clickButton(this)' style='position:absolute;left:85%;top:4%;background:#B20000;color:white;width:70px;height:20px;font- size:15px;' >";
echo "<div class='container' style='display:none;background:white; '>
sometext:-<a href='#'>$url</a><br>
sometext :$b<br>
sometext :$c<br>
</p>";
if(isset($_GET['button1']))
{
echo"<script>alert('msg1');</script>";
include('function.php');
}
echo "</div>";
echo "</div>";
}
?>
</body>
</html>
我们在一个具有相同名称和id的for循环中创建四个按钮,如果我们按下四个FUNCTION.PHP中的一个按钮应该被调用并执行。为此,我们使用了isset函数,但它不起作用。
we are creating four buttons in a for loop with same name and id , if we press even a single button out of four FUNCTION.PHP should be called and executed . for this we have used isset function but its not working.
推荐答案
(document).ready(function(){
(document).ready(function(){
(' .myButton')。click(function(){
var
('.myButton').click(function() { var
ct =
这篇关于按下同一页面上的按钮后加载php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文