How can i pass a variable through url in javascript?
const readMultipleNodesFromDatabase = (buyerId,sellerId) => {
var buyer_id = buyerId;
var seller_id = sellerId;
var chatId = buyer_id + '_' + seller_id;
firebase
.database()
.ref("Message/" + chatId)
.once("value", function (snapshot) {
// $fetchdata = snapshot.val();
window.location.href = "<?php echo $module_site_url .'/add';?>";
});
};
How can i send the chatId through that url?
>Solution :
Not sure if I understand right but
window.location.href = `<?php echo $module_site_url .'/add';?>?chatid=${chatId}`