mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-12-01 06:33:38 +01:00
d296724755
Added Support for standalone webchat by reading a json file Fix for jsonfile-interval in code Added working php script with spam prevention, for webchat
24 lines
558 B
JavaScript
24 lines
558 B
JavaScript
function sendChat(me, 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
|
|
if(response)
|
|
me.onPlayerChat('', response);
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
//curl -d '{"name":"Nickname","message":"Hello"}' http://localhost:8123/up/sendmessage
|