Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'recipeId' of undefined #96

Open
gradedcatfood opened this issue Jul 21, 2015 · 0 comments
Open

Cannot read property 'recipeId' of undefined #96

gradedcatfood opened this issue Jul 21, 2015 · 0 comments

Comments

@gradedcatfood
Copy link

I can't get the widget to open inside of my modal.

I get the following error: "Cannot read property 'recipeId' of undefined"

I've followed the example and cant get the basic window to open.

I have included the pio.latest.v2.js from the CDN right before this js file with the following:

PIO.config({
// required -- set the api key
recipeId: "hidden just in case, I have my stage key in here",
// set the environment to stage
url: "http://staging.widget.print.io/widget/"
});


jQuery(function ($)
{
$(document).ready(function ()
{
    openWidgetOnClick();

    function openWidgetOnClick()
    {
        $('.btn-postcard').on('click', function (e)
        {
            e.preventDefault();
            console.log('button click');

            //this will open the widget-- easy!
            PIO.open();
        });
    }
});
});

I am getting my log of "button click" but then get

open: undefined
Uncaught TypeError: Cannot read property 'recipeId' of undefined

It it somehow the PIO object is not being instantiated correctly for some reason?

So it seems that not using PIO.config was for some reason not working:

Got this to work but still having issues with PIO.config, but PIO.open works:

(function ($)
{
    $('.btn-postcard').on('click', function (e)
    {
        e.preventDefault();
        console.log('button click');

        //this will open the widget-- easy!
        PIO.open({
            recipeId: "key-here",
            url: "http://staging.widget.print.io/widget/",
        });
    });
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant