I am facing a problem with variable scope…I do not want to complicate things,so for now I am going to be very general in my description since I am dealing here with a problem which relates to backbone.
Suppose I have 2 functions…function a and function b.
Function a is called first and function b is called secondly.
Ιn function b there is a value assignment in a global variable—this same variable is located inside function a
It would be reasonable to assume that once execution of function b ends…the value that was set there in the global variable will persist-in function a.
Meaning the global variable in function b will have the value from the assignment in function a.
Am I right or wrong?I hope I was clear…else I will restate the issue.
Outside of a function, if you use var varName = "this"; then it will be globally available to all functions. If you use varName = "this"; (without var), then it will be available only outside of functions.
INSIDE a function, if you use var varName = "this";, it will be available only to that function. If you use varName = "this"; (without var), it will be globally available outside the function.
Then…the parse function is called at line 9 which assigns a value at the global variable closed at line 10
My problem is that the value assigned above is not set at line 62…(the same global variable as mentioned above)
I miss something here but I cannot find what…
Maybe…**maybe…**in order for the variable assignment to take place in the render function…this render function must be called again…for the second time…after parse.
As it stands, your parse method isn’t modifying the response at all, it’s just passing it through unchanged (as the default method does). It seems like what you actually want to be doing in your parse method is this: