test.php
<script src="https://code.jquery.com/jquery-1.11.1.js"></script>
<script>
function testing(){
$.ajax({
url: 'test.php',
type: 'GET',
data: { va: "answer" },
success: function(data) {
// do something;
alert("answer") ; }
});
}
</script>
<textarea><?php
$compare= $_GET['va'];
echo $compare; ?>
</textarea>
<button onclick="testing();">click</button>
Am getting an alert message when I click the button but am getting nothing into the textarea.unable to get the javascript variable into php code. What's wrong here?