generate functionTue, 20 Dec 2022

pass json array to iframe with GET method

function passJsonArrayToIframe(jsonArray, iframeId) { var str = JSON.stringify(jsonArray); var uri = "data:application/json;charset=UTF-8," + encodeURIComponent(str); var iframe = document.querySelector("#" + iframeId); iframe.setAttribute("src", uri); } passJsonArrayToIframe( [ { "a": 1, "b": 2, "c": 3 }, { "a": 4, "b": 5, "c": 6, }, { "a": 7, "b": 8, "c": 9, } ], iframeId );

Javascript
Generate More

Questions about programming?Chat with your personal AI assistant