How to send ANY text via jquery ajax method to php script?
When text entered in textarea is html entity, php $_POST[]/$_GET[] sees it as empty string.
Here is the code:
<head>
<script type="text/javascript" src="/Engine/js/jquery-1.4.4.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("button").click(function(){
$.ajax({
type: "GET",
url: "get.php",
data: "ta=" + $("#ta").val(),
success: function(data){
alert(data);
}
});
});
});
</script>
</head>
<body>
<textarea id="ta"></textarea>
<button>Send it</button>
</body>
and the get.php:
<?php
echo $_GET['ta'];
?>
type in textarea "<b>dog</b>", press the button and empty string will be alerted. Why and how to fix it so that every text will be successfuly delivered to php script?
Thnx in advance