feat: update forms instructions
ci/woodpecker/push/woodpecker Pipeline was successful Details

closes: #1
This commit is contained in:
Aravinth Manivannan 2022-12-31 01:41:18 +05:30
parent 5c359c4090
commit e2a97f1059
Signed by: realaravinth
GPG Key ID: AD9F0F08E855ED88
1 changed files with 8 additions and 2 deletions

View File

@ -24,7 +24,11 @@ Forms can be added to websites with just the HTML code for it. For
instance:
```html
<form id="newsletter-form" method="POST">
<form
id="newsletter-form"
method="POST"
action="https://<librepages-endpoint>/?path=<current-path>&host=<current-host>"
>
<p>
Interested in receiving latest news about our cool product? Sign
up for you fantastic newsletter!
@ -60,7 +64,8 @@ JavaScript code:
const form = document.getElementById("newsletter-form");
async function handleSubmit() {
const url = window.location;
const url =
"https://<librepages-endpoint>/api/v1/forms/submit?host=<current-host>&path=<current-path>";
const data = {
email: document.getElementById("email"),
};
@ -77,4 +82,5 @@ JavaScript code:
form.addEventListener("submit", handleSubmit);
</script>
```
> Note: the following snippet also demonstrates JSON form submission