Chi mi dice dove ho sbagliato?
questo codice dovrebbe alla pressura del tasto invio, deve eseguire quello che c'è di seguito.
codice:$(document).ready(function() { $("#send_msg_usr1_net").keydown(function(e){ if(e.keyCode == 13){ var messaggio = $("#write_here").val(); var id_utente = $("#chatta_con").val(); $.ajax({ type: "POST", url: "ajax/send_msg.php", data: "messaggio=" + messaggio + "&id_utente=" + id_utente, dataType: "html", success: function(msg) { document.getElementById('write_here').value=''; document.getElementById('write_here').focus() } } error: function() { alert("Chiamata fallita, si prega di riprovare..."); } }); }); });

Rispondi quotando
