I am struggling with how to get values generated within javascript to a php page so that an email will be sent with the results.
function sendmemail(){
var data = 'result=' + result.val();
$.ajax({
url: "process.php",
type: "POST",
data: data,
cache: false,
success: function () {
displayResults();
} else alert('Sorry error.');
});
}
That
elsepart is a syntax error, you can’t add an else clause in that way.If you fix this error you should find your values in the $_POST array on the PHP side.
You can also use a Javascript object to pass the values:
which is more readable.