Last active
January 15, 2023 20:02
-
-
Save emrekizildas/9e2de99e7b6c56c5ad0453d2f33ae10a to your computer and use it in GitHub Desktop.
Yeni mesaj gönderme fonksiyonu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mesajGonder() { | |
var mesaj = $("#mesaj").val(); | |
var kadi = $("#kadi").val(); | |
if (kadi != "" && mesaj != "") { | |
var tarih = new Date(); | |
var messageKey = firebase.database().ref("chats/").push().key; //Rastgele bir mesaj keyi gönderir. | |
firebase.database().ref("chats/" + messageKey).set({ | |
message: mesaj, | |
from: kadi, | |
tarih: tarih.getTime() | |
}); | |
//Otomatik olarak en alt kısma odakanılır | |
$("#mesaj").val(''); //Mesaj inputunu temizleyelim | |
} else { | |
alert("Lütfen boş alan bırakmayınız!"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
axofc/Instagram