Hi all,
I'm currently attempting to make some kind of product finder using AJAX.
When a user action is performed (selecting a make of car via <select>) that fires the AJAX call, and a POST parameter is passed with the makeID, but I can't seem to access it in my snippet.
1. jQuery / AJAX on front-end
<script type="text/javascript">
$(document).ready(function(){
url ="http://localhost/madsprings/modx/ajax.html";
$('#make').change(function() {
var makeID = $('#make').find(":selected").val();
//alert(make);
var data = 'make=' + make;
$.post(
url,
"?makeID=" + makeID,
function(data) {
$('#model').append(data);
$('#model').prop('disabled', false);
var model = $('#model').find(":selected").text();
},
"html"
);
});
});
</script>
2. Resource (ajax.html, as called in code above)
3. getModels snippet
echo 'MakeID: ' . htmlspecialchars($_POST["makeID"]);
In the above snippet, it seems that $_POST["makeID"] does not exist. Is there any way to preserve the variable so it may be used, or is there another way?
Thanks
Will