Ok, I'm really at a loss here, and totally can't figure it out.
I have an object literal
say:..
In my object literal,
I call the function, get comments, a property of the object.
it turns an AJAX call on and in the AJAX success method,
I save the data , to self.commentsData
I have used
var self = this;
before the AJAX and therefore SELF refers to the object and not the AJAX.
But I cannot access this property from anywhere else.
I logged self to console, both from inside the AJAX and outside the AJAX and from another function in the object literal (the AJAX is also part of a function in the object literal)
and the weirdest thing shows:
inside the AJAX I see my object Class { with all the properties }
Outside the AJAX I see the object without the commentsData
property,
However, if I click on it, the commentsData
property does show in the drop down menu, just like it does in the other self log. Using self.commentsData
however doesn't seem to work from anywhere in the object except for inside the ajax success method.
I'm really not sure what I'm doing wrong. This almost looks like a bug in javascript, or the chrome console. Has anyone ever seen this before ?
I would post my code but it's fairly long and contains many other functions and would be a tad tedious to look through.