post js added

This commit is contained in:
mpabi 2024-10-10 15:45:55 +02:00
parent f257ee738c
commit a1a57bb1a9
1 changed files with 26 additions and 1 deletions

View File

@ -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>