I can't tell exactly what lines of the code are causing the error. You need to debug your code.
It doesn't matter where to declare the function: inside or outside spRendered().
I can't tell exactly what lines of the code are causing the error. You need to debug your code.
It doesn't matter where to declare the function: inside or outside spRendered().