I have a text-area which saves the data in my database every-time the user hits a key or writes inside the text-area . My problem is that when i want to show a success message like "saved" in a <p>
it repeats itself every-time someone hits a key, i want it to repeatedly show the same message under but only one time.
If possible may remove the "saved" message on success after 10 seconds.
HTML:
<div class="form-group">
<label for="comment">Kommentar:</label>
<textarea class="form-control" rows="5" id="comment" name="comment"></textarea>
<p name="message" id="message"></p>
jQuery:
$("#comment").keyup(function (){
var isTyping = $('#comment').val();
var data = 'result=' + isTyping;
$.ajax({
type: 'POST',
url: "commentsave.php",
data: data,
cache: false,
success: function(html){
$('#message').append('Saved');
}
});
});
PHP:
$name = $_POST['result'];
echo $name;
Thank you very much, dont need you to code for me but just guide me :)