每种尺寸的产品都有3个按钮
<table width="100%" style="font-family:Calibri, Arial; margin-top:10px">
<?php
while($prod_row = mysql_fetch_array($prod_result))
{
if($prod_row['name']<>"" && $prod_row['price']<>0)
{
?>
<tr>
<td style="padding-left:30px"><?php if($cat == "Design"){echo "Rs. ".$prod_row['price'];}else{echo $prod_row['name']." (Rs. ".$prod_row['price'].")";} ?></td>
<td style="text-align:center; vertical-align:middle" id="buy_data"><a role="button" class="btn btn-primary" data-toggle="modal" data-target="<?php if($_SESSION['logged_in']){echo '#buy_product';}else{echo '#login_buy';} ?>" id="<?php echo $prod_row['id']; ?>" name="<?php echo $prod_row['price']; ?>" title="<?php echo $prod_row['name']; ?>">Buy</a></td>
</tr>
<?php
}//if closes
}//while closes
?>
</table>
点击链接后,应打开一个模态弹出窗口,显示点击大小的一些细节
我正在做的是:脚本
$("#buy_data a").unbind("click").click(function(e){
var productnumber = $(this).attr('id');
var prodprice = $(this).attr('name');
var prodsize = $(this).attr('title');
var checkprodid = productnumber;
$.post('session_product.php',{productid: checkprodid, productprice: prodprice, productsize: prodsize});
});
session_product.php
<?php
session_start();
$_SESSION['productprice'] = $_POST['productprice'];
$_SESSION['productsize'] = $_POST['productsize']
?>
模态弹出
<div id="buy_product" class="modal hide fade well" tabindex="-1" role="dialog" aria-labelledby="buy_product_label" aria-hidden="true">
<div class="modal-body">
<h4 id="buy_product_label"></h4>
<p style='color:#000'>
Thank you <b><?php echo $_SESSION['user_name']; ?></b> for showing your interest in our website. You intend to purchase Product ID - <b><?php echo $_SESSION['prod_code']; ?></b><?php if($_SESSION['cat'] == "Photograph"){ ?> of size <b><?php echo $_SESSION['productsize'];} ?></b> worth Rs. <b><?php echo $_SESSION['productprice']."-".$_SESSION['cat']; ?></b><br /><br />
<form id="thanks_popup" action="buy_email_notification.php" method="post">
<input style="text-align:center" class="btn btn-primary" type="submit" id="" name="buy_popup_submit" value="OK, Got it!" />
</form>
</div>
</div>
问题:点击链接时,模态弹出窗口显示与之前点击的链接相对应的产品详细信息。
请让我知道我哪里出错了,应该解决什么问题。谢谢!
答案 0 :(得分:0)
您应该刷新弹出窗口的请求。 当前浏览器文档具有从先前请求生成的旧数据。 为什么不通过ajax调用获取弹出窗口?