Onramp integration using page onload

Anyone have try if onload event will work on onramp iframe?

I am trying to implement the onload() function on iframe
when the page load the iframe will also load on the page

the code right now is not working
anyone can i help?

 <iframe onload="chainCrypto()" class="ratio ratio-16x9" id="myIframe" src="" width="180" height="550" ></iframe>
function buyCrypto() {

async function chainCrypto() {
 let response = await Moralis.Plugins.fiat.buy();
 document.getElementById("myIframe").innerHTML = "BUY CRYPTO";
 document.getElementById("myIframe").src = response.data

maybe you have to wait until the plugins are initialised, you could put await in front of Moralis.start: await Moralis.start(… )

not sure about that
but i do it on different way using 2 iframe

shouldn’t be here: onload=“chainCrypto”`