ChatGPT Error Answered

Post author
Alex Siale

I’m using ChatGPT and it’s almost there, but keeps returning this error:

Uncaught ReferenceError: MemberStack is not defined at HTMLImageElement.

Comments

4 comments

  • Comment author
    Tyler Bell

    can you give us your entire code snippet?

    0
  • Comment author
    Alex Siale
    document.getElementById("save-button").addEventListener("click", function() {
    // Retrieve the current member's data using Memberstack's getCurrentMember method
    memberstack.getCurrentMember().then(function(member) {
    console.log("Memberstack getCurrentMember response:", member);
    // Retrieve the current webflow page ID
    var pageId = window.location.pathname;
    // Create a payload object with the member's data and page ID
    var payload = {
    memberData: member.data,
    pageId: pageId
    };
    console.log("Payload:", payload);
    // Send the payload to the webhook URL endpoint using a POST request
    fetch("https://hook.us1.make.com/n5ww9smmb4i9p579babovkpsrdwpdrfs", {
    method: "POST",
    body: JSON.stringify(payload),
    headers: {
    "Content-Type": "application/json"
    }
    }).then(function(response) {
    // Handle the response from the webhook endpoint
    console.log("Webhook response:", response);
    return response.json();
    }).then(function(data) {
    console.log("Webhook data:", data);
    }).catch(function(error) {
    // Handle any errors that occur during the fetch request
    console.error("Webhook error:", error);
    });
    }).catch(function(error) {
    // Handle any errors that occur during the getCurrentMember request
    console.error("Memberstack getCurrentMember error:", error);
    });
    });
    0
  • Comment author
    Tyler Bell

    the 3rd line from the top, change memberstack.getCurrentMember().then... to window.$memberstackDom.getCurrentMember().then

    0
  • Comment author
    Alex Siale

    I’ll give it a try!

    HEy!!! IT WORKED ♥️

    0

Please sign in to leave a comment.