From 4a074de44bba78891604f9a8ad0af6365d7df8f2 Mon Sep 17 00:00:00 2001 From: AgnesToulet <35176601+AgnesToulet@users.noreply.github.com> Date: Tue, 22 Jul 2025 15:16:23 +0200 Subject: [PATCH] Browser: Use external API --- pkg/web/test.k6.io/browser.html | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pkg/web/test.k6.io/browser.html b/pkg/web/test.k6.io/browser.html index b3144047..6c9aa5b0 100644 --- a/pkg/web/test.k6.io/browser.html +++ b/pkg/web/test.k6.io/browser.html @@ -91,6 +91,19 @@ } sDisplay.textContent = opts; } + + function fetchExternalData() { + const dataDisplay = document.getElementById('external-data-display'); + fetch('https://jsonplaceholder.typicode.com/todos/1') + .then((response) => response.json()) + .then((data) => { + dataDisplay.textContent = 'External data: ' + data.title; + }) + .catch((error) => { + console.error('Error:', error); + alert('API call failed. Check console for error.'); + }); + } @@ -207,6 +220,12 @@ + + + +

External data: ?

+ +
Off page div