Resetare input type text dupa submit
Scris: Dum Apr 26, 2020
Dupa ce dau enter sau click si a trimis mesajul nu mii se reseteaza input textul,imi trmite catre mysql fara reload incarca textul prin div dar nu mii se reseteaza
Js este acesta
Cod: Selectaţi tot
<form action='index.php?page=writechat&rid=<?php echo $rid; ?>' name='contact-form' class='bl_form text-center' method='post' id='insertform' >
<input type='text' id='text' name='message' class='form-control' onfocus="this.value=''" placeholder='Text'>
<input type='submit' id='insert' value='submit' >
</form>
Cod: Selectaţi tot
<script >
$('#insertform').submit(function(){
return false;
});
$('#insert').click(function(){
$.post(
$('#insertform').attr('action'),
$('#insertform :input').serializeArray(),
function(result){
$('#result').html(result);
}
);
});
//afisare la interval de timp
setInterval(function(){
$('#content').load('index.php?page=writechat&rid=<?php echo $rid; ?>');
}, 1000);
</script>