Erich Niemand Erich Niemand - 1 month ago 7
HTML Question

$.get() fails to update div

jQuery:

$("#generate").click(function(){
$.get("<?php PROCESS_PATH; ?>create_detail_cashbook_HTML.php");
return false;
});


HTML markup:

<div class="controls">
<button name="generate" type='button' id="generate" class="btn btn-primary"
onClick="">Generate Report</button>
</div>
<div id="report">
</div>


Ok so jQuery is meant to call PHP process from server and then the php which is working needs to print a report in the report divs.....

I have tried so many things now and I am just not getting this. Sorry guys I am new to all this and I know this is probably a simple problem with a simple solution.

Answer

What you are looking for is .load(), also the code needs to be placed under dom ready handler

jQuery(function ($) {
    $("#generate").click(function () {
        $('#report').load('<?php PROCESS_PATH; ?>create_detail_cashbook_HTML.php')
    });
})
Comments