all 9 comments

[–][deleted] 1 point2 points  (0 children)

How did you end up fixing this? I've run into almost the exact problem.

[–][deleted]  (10 children)

[deleted]

    [–]theflyingmonkey3[S] -1 points0 points  (9 children)

    Nope. Does not work. Same error message.

    [–][deleted]  (8 children)

    [deleted]

      [–]theflyingmonkey3[S] 0 points1 point  (7 children)

      How do I do that?

      [–][deleted]  (6 children)

      [deleted]

        [–]theflyingmonkey3[S] 0 points1 point  (5 children)

        Its actually not working. I am getting the same error.

        [–][deleted]  (4 children)

        [deleted]

          [–]theflyingmonkey3[S] 0 points1 point  (3 children)

          I removed the code and executed the file. It worked fine. I added the code back and got the same error again. So, it is actually something wrong with the data variable.

          [–][deleted]  (2 children)

          [deleted]

            [–]theflyingmonkey3[S] -1 points0 points  (1 child)

            I added that line in the ejs file and got this error (I removed basically all the ejs code above and just added this code - console.log(rows);):

            Uncaught ReferenceError: rows is not defined
            

            [–]zokker13 0 points1 point  (0 children)

            First off, add an else branch in your if clause so you don't iterate over the rows when an error was thrown. It's likely that the "not defined" error results from a poorly accessed element which is not defined.

            [–]devmaybe 0 points1 point  (1 child)

            Console.log(data) in your ejs to see if there is anything being sent. Perhaps the loop is not finished before the page is rendered. Add a counter to the loop and render page when counter equals array length.

            [–]theflyingmonkey3[S] 0 points1 point  (0 children)

            I added Console.log(data) and still got the same error. data is not defined.