chris0hills Posted December 29, 2020 Share Posted December 29, 2020 (edited) I am trying to add embedded content to a site, but I need to make an AJAX request to get the embed URL for the iframe. This request needs to provide a unique identifier for the current logged in customer. Basically like this: (function() { var fd = new FormData(); fd.append('userId', /* somehow get a stable customer id? */); var xhr = new XMLHttpRequest(); xhr.open('POST', myApiUrl, true); xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xhr.onreadystatechange = function() { // ...status checks... var { uri } = JSON.parse(xhr.responseText); var frame = document.createElement('iframe'); frame.src = uri; document.getElementById('myTargetElement').appendChild(frame); } xhr.send(fd); })(); Any suggestions? I noticed that window.Static.SQUARESPACE_CONTEXT.authenticatedAccount provides all of the info that I need, but doesn't appear to be populated for member accounts. Edited December 29, 2020 by chris0hills extra details Link to comment
tuanphan Posted January 3, 2021 Share Posted January 3, 2021 Hi, If you haven't received an answer yet, you can post on some FB groups + Squarespace Customization Resource Groups + Squarespace Community + Squarespace Entrepreneur + Squarespace Rockstars Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message How to: Setup Password & Share url - Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment