我正在制作联系表格,但收到错误
POST http://localhost:3000/contact.json 500 (Internal Server Error)
at contactform.svelte:5
。这是什么contactform.svelte
:
<script>
const submitForm = async(data) => {
const formData = new FormData(data.currentTarget);
const res = await fetch("contact.json", {
method: "POST",
body: formData,
});
};
</script>
<form on:submit|preventDefault={submitForm}>
<div>
<label for="">
What's your name?
<input type="text" name="name">
</label>
</div>
<div>
<label for="">
What's your Email or Phone #?
<input type="email" name="email">
<input type="text" name="phone">
</label>
</div>
<div>
<label for="">
What would you like to tell us?
<input type="text" name="message"> …
Run Code Online (Sandbox Code Playgroud)