0

我需要如何更改loadPopupManual()才能#popup_manual用我所拥有的内容填充 DIV content.php?特别是,我需要将指定的表插入content.php#popup_manual. 此表必须具有由content.php.

测试.php

$(document).ready(function() {
    loadPopupManual();
});

function loadPopupManual() {    // to load the PopupManual DIV
    $('#popup_manual').fadeIn("slow");  
}

<div id="popup_manual">
    // I need to fill this DIV with what I have in 'content.php'
</div>

内容.php

<?php
    include_once 'include/connect_db.php';

    $query="SELECT * FROM aircrafts;";
    $result=execute_query($query);

?>

<script type="text/javascript" charset="utf-8">
         $(document).ready(function(){
             //...
         }
</script>

<table>
<tr>
//... some content is inserted here from DB ($result)
</tr>
</table>
4

1 回答 1

3

你只需要使用$.get

$.get('content.php', function(data) {
    $('#popup_manual').html(data);
});

所以它会变成:

$(document).ready(function() {
    loadPopupManual();
});

function loadPopupManual() {    // to load the PopupManual DIV
    $('#popup_manual').fadeIn("slow"); 
    $.get('content.php', function(data) {
        $('#popup_manual').html(data);
    });
}
于 2012-09-04T15:42:05.657 回答