2011-03-10 07:11:43 +01:00
|
|
|
function sendChat(me, message) {
|
2011-02-18 10:21:55 +01:00
|
|
|
var ip;
|
|
|
|
$.ajax({
|
|
|
|
type: "GET",
|
|
|
|
url: "http://jsonip.appspot.com/?callback=?",
|
|
|
|
dataType: "jsonp",
|
|
|
|
success: function(getip) {
|
2011-02-18 20:15:18 +01:00
|
|
|
var data = '{"name":"'+getip.ip+'","message":"'+message+'"}';
|
|
|
|
$.ajax({
|
|
|
|
type: 'POST',
|
2011-02-19 21:08:14 +01:00
|
|
|
url: 'up/sendmessage',
|
2011-02-18 20:15:18 +01:00
|
|
|
data: data,
|
|
|
|
dataType: 'json',
|
|
|
|
success: function(response) {
|
|
|
|
//handle response
|
2011-03-10 07:11:43 +01:00
|
|
|
if(response)
|
|
|
|
me.onPlayerChat('', response);
|
2011-02-18 10:21:55 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
//curl -d '{"name":"Nickname","message":"Hello"}' http://localhost:8123/up/sendmessage
|