Source Code : test_players.html
<script type="text/javascript">
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Όνομα Ζώο Φυτό - Το παιχνίδι </title>
<script src="tests_pretty.js"></script>
</head>
<body>
Example :
<mark>Services Word Games</mark>
<br/> <br/>
<script>
displayInfo(" api : " + URL, null, 'url');
let sPlugin = "playerSettings";
let gameDBPin = 'EE12954';
let nickname = "dsphinx_OK";
serviceCoreData(URL, {
"configuration": [sPlugin, 'create', ''],
'pin': gameDBPin,
'nickname': nickname
})
.then(data => {
let responseData = data;
displayInfo(" Create player ", responseData, 'player');
});
serviceCoreData(URL, {
"configuration": [sPlugin, 'info', ''],
'pin': gameDBPin,
'nickname': nickname
})
.then(data => {
let responseData = data;
displayInfo(" info player ", responseData, 'oplayer');
});
// serviceCoreData(URL, {
// "configuration": [sPlugin, 'disable', ''],
// 'pin': gameDBPin,
// 'nickname': nickname
//
})
// .then(data => {
// const responseData = JSON.parse(data);
// displayInfo(" disable player ", responseData, 'test');
//
});
</script>
</body>
</html>
</script>
Typical Syntax Call
<script type="text/javascript">
let URL = 'https://xxx.xxx.xxx.xxx/service.php'
let sPlugin = "plugin";
//
const data = { "configuration": [sPlugin, "action", "extra"],
'word': ' Απόδειξη ',
};
//
fetch(URL, { method: "POST", body: JSON.stringify(data),
headers: { "Content-type": "application/json;
charset=UTF-8"
}
}).then(response => response.json())
.then(dataRet => {
const returnJSON = JSON.parse(dataRet);
// returnJSON
// ....
///
})
.catch((error) => {
displayInfo(" Error : " + error, data);
});
</script>