Source Code : test_Stemmer_ManyWords.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 = "GRStemmer";
const data = {
"configuration": [sPlugin, "", ""],
'words' : [ 'Απόδειξη', 'Κώστας', "Καγκουρό", "Κυκλάμινο", 'σκατά', 'malakos', 'πορδή', 'πορδουλα', 'σκατένιος', 'σκατούλα'],
};
fetch(URL, {
method: "POST",
body: JSON.stringify(data),
headers: {
"Content-type": "application/json;
charset=UTF-8"
}
}).then(response => response.json())
.then(dataRet => {
displayInfo(" Service Call ", data, 'retCall');
const returnJSON = JSON.parse(dataRet);
displayInfo(sPlugin + " Returns Json ", returnJSON, 'retInfo');
})
.catch((error) => {
displayInfo(" Error : " + error, data);
});
</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>