The first time the page loads, there will not be anything in the POST data array. After it runs I want to be able to use whatever variable I send in the POST data in the PHP code so I can query my database based on parameters sent. Do I need to reload the page somehow to do this?
PHP:
if(isset($_POST['boarder'])){
$boarder = $_POST['boarder'];
function boarderCheck($boarder){
echo "<script type ='text/javascript'>alert('$boarder');</script>";
}
boarderCheck($boarder);
} else {
?>
<script defer src="http://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="map.js"></script>
<?
};
?>
JavaScript (map.js)
$.ajax({
type: "POST",
data: {boarder: 'test'},
dataType: 'text',
success: function(response) {
console.log(response);
}
})