我有这个模式的jQuery AJAX:
$('#switch_modal').on('show.bs.modal', function (e) {
var rowid = $(e.relatedTarget).attr('data-id');
$.ajax({
type : 'post', // commented for this demo
url : 'pars.php', // commented for this demo
data : 'id='+ rowid,
success : function(data) {
$('.fetched-data').show().html(rowid); // show rowid for this demo
}
});
});
我的MySQL查询:
$query="SELECT * FROM games WHERE winner='' ORDER BY amount DESC";
while ($row = $result->fetch_assoc()) {
我的模态数据-ID:
<a href="#viewgame" data-toggle="modal" data-id="<?php echo $row['id'];?>"">
哪有我会像使用PHP文章一样使用var rowid?类似的东西:
$id = $_POST['rowid'];
echo $id;
'data:'rowid ='+ rowid,' – Rayon
仍然无法工作! – Turbo19973
究竟是什么问题? – Rayon