I need to run some PHP function when a button is clicked. I know this is not supposed to be php\'s use, rather js should do it, but what my functions are doing in gathering data
var button = document.getElementById("button");
button.addEventListener("click" ajaxFunction, false);
var ajaxFunction = function () {
// ajax code here
}
Alternatively look into jquery ajax http://api.jquery.com/jQuery.ajax/