mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-24 03:05:28 +01:00
added chatSend() function
This commit is contained in:
parent
5ddaf940ed
commit
10f93c02c1
21
web/chat.js
21
web/chat.js
@ -0,0 +1,21 @@
|
||||
function sendChat(message) {
|
||||
var ip;
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "http://jsonip.appspot.com/?callback=?",
|
||||
dataType: "jsonp",
|
||||
success: function(getip) {
|
||||
var data = { name: getip.ip, message: message };
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/up/sendmessage',
|
||||
data: data,
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
//handle response
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
//curl -d '{"name":"Nickname","message":"Hello"}' http://localhost:8123/up/sendmessage
|
@ -212,6 +212,12 @@ DynMap.prototype = {
|
||||
type: 'text',
|
||||
value: 'not working yet'
|
||||
})
|
||||
.keydown(function(event) {
|
||||
if (event.keyCode == '13') {
|
||||
event.preventDefault();
|
||||
alert(this.value);
|
||||
}
|
||||
})
|
||||
.appendTo(chat);
|
||||
var chatcursor = me.chatcursor = $('<span/>')
|
||||
.attr({ id: 'chatcursor'})
|
||||
|
Loading…
Reference in New Issue
Block a user