From 6dbd73d8264a12de329c4525c6e2a03a8533ee8d Mon Sep 17 00:00:00 2001 From: Calle Luks Date: Thu, 11 Feb 2021 16:07:18 +0100 Subject: [PATCH] Improve AJAX example [ci skip] The example uses `fetch` to retrieve HTML from the server and append it to an element on the page. This commit updates the example to append the response HTML rather than the full response object. --- guides/source/working_with_javascript_in_rails.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/source/working_with_javascript_in_rails.md b/guides/source/working_with_javascript_in_rails.md index a0398a2484..d2eac05b0d 100644 --- a/guides/source/working_with_javascript_in_rails.md +++ b/guides/source/working_with_javascript_in_rails.md @@ -44,7 +44,7 @@ fetch("/test") .then((data) => data.text()) .then((html) => { const results = document.querySelector("#results"); - results.insertAdjacentHTML("beforeend", data); + results.insertAdjacentHTML("beforeend", html); }); ```