Php+jquery interaction

I am 84.5 y/o and stuck. I want to create a page and interact with it. this is what i have …

Send an HTTP POST request to a page and get the result back

<?php // ----- service a POST ----- if ($_SERVER["REQUEST_METHOD"] == "POST") { echo "
at server POST:"; foreach ($_REQUEST as $key => $value) { echo "
"; echo "
$key => $value"; } } ?>

and all it does is respond with the entire page code, what you see above. I have extensive C# and visual-studio but this is a paradyme shift and i am stuck. I just want to send a few fiels and a button id and respond with new value, not the whole page. I want the reply to be something i can ‘explode’ and set elements in the page using getelementbyid().
thanks for your time.
jim murray

======================================================

Hello Jim,

if the server you are sending your request to is responding with a page only containing your code, then chances are, the server is not executing the PHP logic and treating them as plain old text files and serves them as they are.

In order to solve the problem, you’d need to enable the PHP mode (for apache) or setup the FCGI protocol if NGINX is the server you are using.

Please let me know if you need to know more, I’m happy to help.