Javascript 打开远程页面进入引导模式

Javascript 打开远程页面进入引导模式,javascript,php,mysql,twitter-bootstrap,bootstrap-modal,Javascript,Php,Mysql,Twitter Bootstrap,Bootstrap Modal,这里有一些东西似乎有重复的问题。我想从一个远程页面将内容打开到一个模式中,该页面由MySql数据库填充。我也希望模态打开与我的自定义样式等,我已经走了这么远,但在那之后,我已经卡住了。这是到目前为止的代码 页面上的输出: $output .='<h4><a class="md-trigger" data-OfferID="' . $offer_id . '" href="#" data-modal="offer_modal">' . $title . '</a>

这里有一些东西似乎有重复的问题。我想从一个远程页面将内容打开到一个模式中,该页面由MySql数据库填充。我也希望模态打开与我的自定义样式等,我已经走了这么远,但在那之后,我已经卡住了。这是到目前为止的代码

页面上的输出:

$output .='<h4><a class="md-trigger" data-OfferID="' . $offer_id . '" href="#" data-modal="offer_modal">' . $title . '</a></h4><hr>';
作为参考,远程页面根据id加载数据,然后填充modal:

<?php
extract($_GET);
?>

<?php 
require('inc/connect/config.php');
$offer = (int) $_GET['OfferID']; ?>
<?php
try {

$code_sql = 'SELECT * FROM codes WHERE id LIKE :code_id';
$query = $db->prepare($code_sql);
$code_params = array(':code_id' => $offer);
$query->execute($code_params);

$code_r = $query->fetch(PDO::FETCH_ASSOC);
$c_title = $code_r['title'];
$c_desc = $code_r['description'];
$c_redeem = $code_r['redemption'];
$c_textcode = $code_r['textcode'];
$c_exp = $code_r['expiry'];
$c_terms = $code_r['terms'];
$c_url = $code_r['url'];

} catch (PDOException $e) {
echo "failed to load offer";
exit;
}
?>

<button type="button" class="close close-md" data-dismiss="modal" aria-label="Close"><h3><span aria-hidden="true">&times;</span></h3></button>
<h5><?php echo $c_title; ?></h5>
<p><?php echo $c_desc; ?></p>
<h3><?php echo $c_textcode; ?></h3>
<p><?php echo $c_redeem; ?></p>
<p class="small-text"><?php echo $c_terms; ?></p>

&时代;

目前,我遇到的问题是模式只加载一次,当单击列表中的顶部项目时,它不会在单击列表中的任何其他项目时加载。。。我做错了什么!!我对这一切都很陌生,所以请对我放松:)

提前谢谢


Kaylee用这个例子进行测试

$('.md-trigger').on('click',function(){
      var OfferID=$(this).attr('data-OfferID');
      $.ajax({url:"Open-Offer.php?OfferID="+OfferID,cache:false,success:function(result){
     $(".md-content").empty().append(result);
}});
});

用这个例子进行测试

$('.md-trigger').on('click',function(){
      var OfferID=$(this).attr('data-OfferID');
      $.ajax({url:"Open-Offer.php?OfferID="+OfferID,cache:false,success:function(result){
     $(".md-content").empty().append(result);
}});
});
$('.md-trigger').on('click',function(){
      var OfferID=$(this).attr('data-OfferID');
      $.ajax({url:"Open-Offer.php?OfferID="+OfferID,cache:false,success:function(result){
     $(".md-content").empty().append(result);
}});
});