Sending requests with PHP
diff --git a/js/utils.js b/js/utils.js
index 9f0a166..8c436fd 100644
--- a/js/utils.js
+++ b/js/utils.js
@@ -5,19 +5,15 @@
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
};
-function b64EncodeUnicode(str) {
- // first we use encodeURIComponent to get percent-encoded UTF-8,
- // then we convert the percent encodings into raw bytes which
- // can be fed into btoa.
- return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g,
- function toSolidBytes(match, p1) {
- return String.fromCharCode('0x' + p1);
- }));
-}
-
-function b64DecodeUnicode(str) {
- // Going backwards: from bytestream, to percent-encoding, to original string.
- return decodeURIComponent(atob(str).split('').map(function(c) {
- return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
- }).join(''));
+function send_request(id, msg) {
+ $.ajax({
+ 'url': '../request.php',
+ 'type': 'GET',
+ 'dataType': 'json',
+ 'data': { 'id': id, 'msg': msg },
+ 'success': function(data) { alert("S'ha avisat a l'altre jugador"); },
+ 'error': function(xhr, status, error) {
+ alert(xhr.responseText);
+ }
+ });
}