I am trying to create a simple calculator. Using PHP, I managed to get the values ββfrom the input fields and go from the POST menu, but, of course, the form is updated after submitting.
Using Javascript, I tried using
function changeText(){
document.getElementById('result').innerHTML = '<?php echo "$result";?>'
but this would continue to give a β0β response after the button was clicked because it could not get the values ββfrom the POST since the form was not submitted.
So, I'm trying to solve either the easiest way to do this via ajax, or something like that
or get the selected values ββin the navigation menu using JavaScript.
I read a few ajax examples on the internet, but they are quite confusing (not familiar with the language)
James source
share