Page 1 of 2

ReferenceError: is not defined

Posted: Sat Nov 09, 2013 9:50 pm
by Branden

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!


ReferenceError: is not defined

Posted: Sat Nov 09, 2013 10:10 pm
by maxkatz

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


ReferenceError: is not defined

Posted: Sat Nov 09, 2013 10:27 pm
by Branden

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


ReferenceError: is not defined

Posted: Sat Nov 09, 2013 10:40 pm
by maxkatz

ReferenceError: is not defined

Posted: Sat Nov 09, 2013 10:46 pm
by Branden

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.


ReferenceError: is not defined

Posted: Sun Nov 10, 2013 12:33 am
by Illya Stepanov

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?


ReferenceError: is not defined

Posted: Sun Nov 10, 2013 8:59 pm
by Branden

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


ReferenceError: is not defined

Posted: Sun Nov 10, 2013 9:21 pm
by Illya Stepanov

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


ReferenceError: is not defined

Posted: Sun Nov 10, 2013 9:25 pm
by Branden

Done... attached!
Image


ReferenceError: is not defined

Posted: Sun Nov 10, 2013 10:30 pm
by Branden

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.