I'm trying to send the contents of a textarea to another page, as per the code below:
<textarea id="mensagem" rows="8" cols="100" maxlength="500" style="border-radius: 6px; resize:none;width: 90%;height: 65px; margin:0 auto;">
ESCREVA ALGO AQUI
</textarea>
<button type="button" class="btn btn-success" id="sendMSG">Enviar</button>
<script>
$(document).ready(function(){
$("#sendMSG").click(function(){
var url = "enviamsg.php";
var email = "<?php echo $_SESSION['email']?>";
var msg = $('#mensagem').val();
alert("teste");
$.post(url,{postemail:email,postmsg:msg},
function(result) {
$("#result").html(result); // Só pra verificar retorno
});
});
});
</script>
Clicking on the button, nothing happens. I guess the problem is in the button call because I tried to comment a few lines and leave only a few alerts, and even then nothing happened. Would anyone know where I'm going wrong?
Thank you.