i made a form and i want it to post on the page without refreshing but i dont get what im doing wrong, because it doesnt work.
here is the form:
<form action="">
<textarea id="message" rows=5 cols=100 wrap="physical"></textarea>
<input type="submit" value="send" id="button"/>
</form>
here is the jquery script:
$(function(){
$("#button").click(function(){
var message= $("#message").val();
$.ajax({
type: "POST",
url:"index.php",
data: message,
success: function(){
alert("it wroks:")+ message; //so i know if it works, but it doesnt.
}
});
return false;
};
});
and the php that handles and shows the post:
<?php
$arival=$_POST['message'];
echo $arival;
?>
im doing something wrong, but i really dont know what.
here is the form:
<form action="">
<textarea id="message" rows=5 cols=100 wrap="physical"></textarea>
<input type="submit" value="send" id="button"/>
</form>
here is the jquery script:
$(function(){
$("#button").click(function(){
var message= $("#message").val();
$.ajax({
type: "POST",
url:"index.php",
data: message,
success: function(){
alert("it wroks:")+ message; //so i know if it works, but it doesnt.
}
});
return false;
};
});
and the php that handles and shows the post:
<?php
$arival=$_POST['message'];
echo $arival;
?>
im doing something wrong, but i really dont know what.