what does
script.setAttribute('src', '/json?callback=loadJsonPhotos');
JavaScript code mean?
That's a little snippet of code to set the src (source) attribute of a Javascript include tag to /json?callback=loadJsonPhotos. Once that line of code runs, the browser will fetch the data from that URL and execute the script that returns. The data that script returns will be wrapped in a function like so:
loadJsonPhotos({data: "blah"});
All you need to do to use that data is write a function called loadJsonPhotos that will be called once the data has loaded.