ChatServer/pages/js/conversations.js

37 lines
1.3 KiB
JavaScript
Raw Normal View History

2016-08-17 12:31:29 +00:00
function addConversation() {
var json = JSON.stringify({ "action": "add" });
$.ajax({
url: "/conversations", data: json, method: "POST", success: function (result) {
document.getElementById("conversations").innerHTML += result;
showAddUserToConv();
2016-08-17 12:31:29 +00:00
}, error: function (result) {
showError(result.responseText);
}
});
return false;
}
function showAddUserToConv() {
var json = JSON.stringify({ "action": "adduserdialog" });
$.ajax({
url: "/conversations", data: json, method: "POST", success: function (result) {
document.getElementById("hoverdialog").innerHTML = result;
document.getElementById("hoverdialogcont").style.display = "table";
}, error: function (result) {
showError(result.responseText);
}
});
}
function addUserToConv() {
var liste = document.getElementById("searchuserlist");
var json = JSON.stringify({ "action": "adduser", "userid": liste.options[liste.selectedIndex].value });
$.ajax({
url: "/conversations", data: json, method: "POST", success: function (result) {
document.getElementById("hoverdialogcont").style.display = "none";
}, error: function (result) {
showError(result.responseText);
}
});
}