I have a code in javascript
calling a file PHP
:
$.post("subscript.php", {
idPost: idPost
}, function(response2) {
//Joga o resultado no lugar desejado.
$("#respostaID").html(response2);
});
When this code responds, instead of returning the response of the PHP
that was executed, it returns me the code of the commented subscript.php file inside the HTML
of the parent page.
Code PHP
:
<?php
$idPost = $_POST['idPost'];
echo "<h1>".$idPost."</h1>";
?>
Answer that I have after the response from javascript
:
<div id="respostaID" class="btn-group btn-group-justified pull-right"><!--?php
$idPost = $_POST['idPost'];
echo "<h1-->".$idPost."";
?></div>
How do I make my file in PHP
run and only bring me what I need?
Both files are in the format .php
NOTE: These codes are being implemented alongside a wordpress theme.