I already have a web application in java and now I want to migrate to php, the problem is that when trying to execute the php code does not show it how it should, I used a test code:
<button onclick="enviaPeticion()">
Pedir
</button>
<h1 id="titulo"></h1>
<script>
function enviaPeticion(){
var elObjeto= new XMLHttpRequest();
elObjeto.open('GET','prueba.php', true);
elObjeto.onreadystatechange = function(){
document.getElementById('titulo').innerHTML = elObjeto.responseText;
}
elObjeto.send();
}
</script>
In the php file it is:
<?php
echo 'Hola Mundo';
?>
When trying to execute it through AJAX he sends me the following answer:
<!--?php
echo 'Hola Mundo';
?-->
In html tags I already know that
<!-- -->
is to comment, what I do not understand is why he sends it that way, if someone could help me, I would be very grateful