GifproGifpro

リロード不要!Server Actionsで即フォーム送信

VISTA DE CÓDIGO

P

Prompt

Create a single HTML file with embedded CSS and JS that demonstrates a Next.js-like Server Actions form submission using a simple mock server. The form should have fields for name and email, and submit without page reload, showing a loading state and success/error messages. Use only vanilla JavaScript (no framework) but style it with Tailwind CSS via CDN. The mock server should simulate a 1.5 second delay and return a success response.

この例は、ページリロードなしでServer Actions風のフォーム送信を実演します。バニラJSでフォーム送信をインターセプトし、入力検証、ローディングスピナー表示、1.5秒の遅延シミュレーション、成功/エラーメッセージ表示を行います。Tailwind CSSでクリーンでモダンな見た目にスタイリングしています。

¿Te resultó útil este prompt?

Comentarios

Los comentarios aparecen después de la moderación

Inicioヘルプ