post js added
This commit is contained in:
parent
f257ee738c
commit
a1a57bb1a9
27
index.php
27
index.php
|
@ -33,6 +33,31 @@
|
||||||
</p>
|
</p>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
fetch("http://192.168.80.31:8080/p10.10/php/post.php", {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json" // Bezpośrednie przekazanie nagłówka
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
"ln": "Kowalski",
|
||||||
|
"fn": "Jan",
|
||||||
|
"email": "jan.kowalski@example.com",
|
||||||
|
"subject": "Test subject",
|
||||||
|
"path": "/path/to/photo.jpg"
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.then(response => {
|
||||||
|
return response.json(); // Oczekujemy odpowiedzi w formacie JSON
|
||||||
|
})
|
||||||
|
.then(data => {
|
||||||
|
console.log("Response from server:", data); // Wyświetlenie odpowiedzi z serwera
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error("There was a problem with the fetch operation:", error);
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue