ajax我有什麼問題嗎? get_details.php不會在模態使用ajax填充來自php頁面的數據的bootstrap模態
$('#myModal').on('show.bs.modal', function(){
$.ajax
({
type: "POST",
url: "get_details.php",
data: dataString,
cache: false,
success: function(r)
{
$("#detail").html(r);
}
});
});
加載這麼說吧,我這裏面get_details.php。我想使「測試」是在模態
<?php echo "test";?>
這裏是我的模態
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body" id="detail">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
檢查你怎麼得到的迴應'的console.log(R)' – Thamaraiselvam
另外我想,'類型: POST'是錯誤的,因爲你想'GET'的東西,而不是張貼。 – Twinfriends
@Thamaraiselvam是對的,ajax的回報是什麼? – vijay