I need to call a couple small PHP functions that should execute after the user makes changes in the DOM. I know this can be done by capturing the change in jquery, then pointing an ajax call to a separate script with the function inside it; but having a few of these small functions I would rather not make a file for each, if possible. As such, is there a way to include the PHP code directly within the ajax call and not go to a separate url?
EDIT 1
Assuming a post request is being made, something like the following is what I'd like to do:
$("select").change(function() {
$.post("<?php ... ?>", {option: $(this).val()}, function(return) {
//do stuff with results
}
});