小编Arm*_*196的帖子

Sveltekit 制作联系表单的端点问题

我正在制作联系表格,但收到错误 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)

javascript endpoint svelte sveltekit

1
推荐指数
1
解决办法
2527
查看次数

标签 统计

endpoint ×1

javascript ×1

svelte ×1

sveltekit ×1