Anjanesh LekshminarayananforAlpine JSalpinejs.in·Nov 22, 2023Using AJAX to load an image in the backgroundEver tried loading an image using AJAX/fetch? Here's a super simple example with AlpineJS parsing an IMG's src value as JavaScript. It can't get simpler than this. <div x-data="{}"> <img :src="await(await fetch('https://domain.com/myImage.jpg'))....58 readsAjaxAdd a thoughtful commentNo comments yetBe the first to start the conversation.