Hi
Thank you for your help. I managed to get things going.
Now next step is to read some data and parse it.
I got following script which sends some data to serve.
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
</head>
<body>
<h1>Localhost service call test</h1>
<label for="url-call">URL to call:</label>
<input style="width: 400px;" type="text" id="url-call" name="url-call" value="https://127.0.0.1:8000/sandbox"><br><br>
<a id="test-call" href="#">Call</a>
<p id="odgovor"></p>
</body>
<footer>
<script type="text/javascript">
$("#test-call").click(function(){
$.ajax({
type: 'POST',
url: $("#url-call").val(),
dataType: 'json',
data: {
"id": 10,
"title": "HP Pavilion 15-DK1056WM",
"description": "HP Pavilion 15-DK1056WM Gaming...",
"price": 1099,
"discountPercentage": 6.18,
"rating": 4.43,
"stock": 89,
"brand": "HP Pavilion",
"category": "laptops",
"thumbnail": "https://i.dummyjson.com/data/products/10/thumbnail.jpeg",
"images": [
"https://i.dummyjson.com/data/products/10/1.jpg",
"https://i.dummyjson.com/data/products/10/2.jpg",
"https://i.dummyjson.com/data/products/10/3.jpg",
"https://i.dummyjson.com/data/products/10/thumbnail.jpeg"
]
},
success: function (r) {
$("#odgovor").html("Odgovor: <br> Success: <br> " + JSON.stringify(r, null, 2));
},
error: function (r) {
$("#odgovor").html("Odgovor: <br> Error: <br> " + JSON.stringify(r, null, 2));
}
}, $(this));
});
</script>
</footer>
</html>
I get the data but it is is not in real json format it is some strange outpout.
Here is the received data.
"id=10&title=HP+Pavilion+15-DK1056WM&description=HP+Pavilion+15-DK1056WM+Gaming...&price=1099&discountPercentage=6.18&rating=4.43&stock=89&brand=HP+Pavilion&category=laptops&thumbnail=https%3A%2F%2Fi.dummyjson.com%2Fdata%2Fproducts%2F10%2Fthumbnail.jpeg&images%5B%5D=https%3A%2F%2Fi.dummyjson.com%2Fdata%2Fproducts%2F10%2F1.jpg&images%5B%5D=https%3A%2F%2Fi.dummyjson.com%2Fdata%2Fproducts%2F10%2F2.jpg&images%5B%5D=https%3A%2F%2Fi.dummyjson.com%2Fdata%2Fproducts%2F10%2F3.jpg&images%5B%5D=https%3A%2F%2Fi.dummyjson.com%2Fdata%2Fproducts%2F10%2Fthumbnail.jpeg"
Regards Matija