1
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, rather than bring the answer from PHP
that was executed, it returns me the code of the commented subscript.php file inside the HTML
mother-page.
Code PHP
:
<?php
$idPost = $_POST['idPost'];
echo "<h1>".$idPost."</h1>";
?>
Answer I have after the reply from javascript
:
<div id="respostaID" class="btn-group btn-group-justified pull-right"><!--?php
$idPost = $_POST['idPost'];
echo "<h1-->".$idPost."";
?></div>
How to make my file on PHP
execute and bring me only what I need?
Both files are in format .php
NOTE: These codes are being implemented together with a wordpress theme.
PHP works without being via ajax? IE, you can process PHP?
– Sergio
Take a look at the server, it is not processing PHP
– Rafael Telles
Good guys, this is a gambit I’m doing inside a wordpress. php ta normal because I’m running wordpress.
– Giulio Costa