I have a an HTML button where I want the onclick to call a PHP function. I need to use AJAX to do this but I am totally lost. There is more that occurs inside the php functi
Using jQuery (untested):
function PrintDist() {
var submitButton = $(this).find('*:submit');
$.post(this.action, $(this).serialize(), function() {
alert('Form submitted!');
submitButton.attr('disabled', 'false').attr('value', 'Enter');
});
submitButton.attr('disabled', 'true').attr('value', 'Posting...');
return false;
}
Use a proper form as your HTML (for people without Javascript, and for the script to work nicely):