Fetch API: live product search

Results update as you type. Each change waits 300 ms, then calls /api/products with fetch(); the server takes about 700 ms to respond. If you type again before a response arrives, the old request is cancelled. Check your script by searching speaker in Audio — the summary should read 5 matching products.

Loading…