<?= var_export($_POST, true) ?>
<button onclick="sendPostWithData('test.php', {name: 'John', surname: 'Doe'})">Send</button>
<script src="script.js"></script>