codex-lv2-may-2025

Level Navigation: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 Current Level: 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32


đź§Ş Level 18: Connect to Button

What You’ll Do

Connect your AI function to the button click.

Instructions

In the button’s click handler (from Step 2), after showing “Thinking…”, call sendToModel(). This call is the proof-of-life test on button click.

đź’ˇ Code Hints

Connecting button clicks to API calls? You’ll need to call your function from within the button’s event handler. Check out the Functions section in SNIPPETS.md for how to invoke functions.

âś… Check

  1. Open your webpage in a browser
  2. Open Chrome DevTools (F12) and go to the Console tab
  3. Click your Send button
  4. You should see “Thinking…” appear in the output area
  5. In the Console, you should see either:
    • A successful API response (JSON data)
    • An error message (this is normal if you haven’t set up your API token yet)
  6. If you see no console output at all, check that your button click handler is calling sendToModel()

Next: Level 19 - Test & Check - Model Call Complete



Level Navigation: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 Current Level: 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32