dynmap/web/js/chat.js
Jason Booth d296724755 Fix client side timestamp problem
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
2011-03-10 00:11:43 -06:00

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