I'm trying to POST a variable through a select box, which will submit the data through AJAX and then I need to be able to use that vairable on the original page, which updates the sql queries.
Here is the code I have got so far:
<script type="text/javascript">
function selectCategory() {
document.getElementById('categoryText').addEventListener("change", function() {
var xmlhttp=new XMLHttpRequest();
xmlhttp.open("GET","/category.php?category3="
+document.getElementById("categoryText").value, false);
xmlhttp.send(null);
});
}
</script>
and the AJAX (which im struggling with)
<?php
/*Retreving the Value from the select box */
$categoryFilter = $_GET['category3'];
?>