is it possible to add an php code directly to the Ajax Query instead of extern url?
My Ajax:
<div id="show"></div>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function() {
setInterval(function () {
$('#show').load('data.php')
}, 3000);
});
</script>
i dont want use the extern file data.php
, can i add an php code directly?
Like this one:
<?php
include('includes/config.php');
if ($connection->connect_error) {
die("Connection error: " . $connection->connect_error);
}
$result = $connection->query("SELECT input_address FROM payments");
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
echo $row['input_address'] . '<br>';
}
} else {
echo "Wait..";
}
?>
Example:
$('#show').load(' <?php myphpcode?> ')