Branden
Posts: 0
Joined: Sun Nov 03, 2013 12:10 am

ReferenceError: is not defined

Still trying to make progress on my app. Seems like each page is a battle...

I'm trying to populate a database collection with new data. When I test, it complains "Uncaught ReferenceError: userId is not defined". It's supposed to be getting userId from localStorage, and the localStorage variable clearly exists. I don't understand why it can't find userId.

Image Image

Am I doing something wrong?

Thanks!

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

ReferenceError: is not defined

Add console.log(value) to mapping and see what you get.

Branden
Posts: 0
Joined: Sun Nov 03, 2013 12:10 am

ReferenceError: is not defined

Where in the mapping am I adding that?
And I assume by "value" you mean "userId"?

Branden
Posts: 0
Joined: Sun Nov 03, 2013 12:10 am

ReferenceError: is not defined

Okay added console.log(value)....

Still same error: Uncaught ReferenceError: userId is not defined

Nothing gets sent to console.log. It appears to error out before it gets to that point.

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

ReferenceError: is not defined

Hi Branden, it will not fix this error - it will help you to debug and test your code.
:: https://developers.google.com/chrome-...

Can you post the screenshot of entire error message?

Branden
Posts: 0
Joined: Sun Nov 03, 2013 12:10 am

ReferenceError: is not defined

Right, I know it's just for debugging purposes. I guess what I'm trying to say is that it can't display the value in console.log because the script errors out too soon.

I've attached the screenshot of the error, per your request.

Thanks! :) Image

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

ReferenceError: is not defined

And please open the tab for this error.
:: https://developers.google.com/chrome-...

Branden
Posts: 0
Joined: Sun Nov 03, 2013 12:10 am

ReferenceError: is not defined

Done... attached!
Image

Branden
Posts: 0
Joined: Sun Nov 03, 2013 12:10 am

ReferenceError: is not defined

Okay, I think I found a work-around to my problem. In fact, I think my work-around is better than the way I was originally doing it.

With the help of this post (https://getsatisfaction.com/apperyio/...) I was able to restructure my Mappings a bit.

I still don't know why it couldn't find userId, but I worked around it by using a different variable in localStorage.

What's also odd is that even though it is now working as expected, I'm getting a "400 Bad Request" error in the console log. But I want to do some cleaning up before I tackle this. It may just be left-over code from various attempts. :-)

I think I'm all set with this issue for now. Thank you for your assistance and patience, you guys have been great.

Return to “Issues”