jasmine825 jasmine825 - 4 months ago 6
HTML Question

Information to display in a dialog box not another page

How can I make each button instead of going to another page to display the information on a dialog box in the same page.
This code here is in the head to call the id from the other file

<script type="text/javascript">

function getvoucher(id){

$.get("http://52.91.139.19/inactive/test.php?id=" + id, function(data,status){

return data;

});

}

</script>


Then I have this button in my while loop:

<td><?php echo $row['voucher_id']; ?></td>
<td> <?php echo'<a href="test.php?id=' . $row['voucher_id'] . '"> Click here</a>'; ?></td>


When I click on the button it displays what I want in test but instead I want it to show in a dialog box, any help?

Answer

try this:

$.get("demo_test.php", function(response){
    $('#popup').html(response);    
    // this will put your response to popup div

    // now popup it
    $('#div_add_permission').dialog({
        title   : 'Title',
        width   : 400,
        height  : 400,
        modal   : true,
        closeOnEscape: false
    });
});

<div id="popup"></div>