dynmap/web/js/chat.js

21 lines
437 B
JavaScript
Raw Normal View History

var ip;
$.ajax({
type: "GET",
url: "http://jsonip.appspot.com/?callback=?",
dataType: "jsonp",
success: function(getip) { ip = getip.ip; }
});
function sendChat(me, message) {
var data = '{"name":"'+ip+'","message":"'+message+'"}';
2011-02-18 10:21:55 +01:00
$.ajax({
type: 'POST',
url: 'up/sendmessage',
data: data,
dataType: 'json',
success: function(response) {
//handle response
if(response)
me.onPlayerChat('', response);
2011-02-18 10:21:55 +01:00
}
});
}