[Solved] Script error, where to add if


I notice your usage of “photos”, but I don’t see the variable being declared anywhere…
At least, inside the main function (since it won’t be global), declare your photos var:

var photos = [];

Aditionally, like Chris says, always check if the var is defined. 🙂
Source: https://stackoverflow.com/a/17748905/2599797

if (photos) // Simple
if (typeof(photos) != 'undefined') // Type matching, if photos defaults to true it won't pass
if ($.isArray(photos)) // jQuery based Javascript/Prototype native array check

3

solved Script error, where to add if