mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-12-26 18:47:40 +01:00
22 lines
497 B
JavaScript
22 lines
497 B
JavaScript
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
|