Seems to be working now. I had to stick the brackets in the external file & also change its single quotes to double, and switch .dayKey to [dayKey] in the script:
Code:
$.get('alldatestest.txt', function(data) {
var picsObj = JSON.parse(data);
alert(dayKey + ' ' + picsObj[dayKey]);
});
- returns "0812 100315/5065359-R1-19-20_scaled.jpg"
This was also helpful:
http://json.parser.online.fr/
Thanks Peter!
Edit: to clarify, here's the new "alldatestest.txt" -- I also had to wrap keys in quotes per above online parser:
Code:
{"0810":"images/CNV00016-interim.jpg",
"0812": "100315/5065359-R1-19-20_scaled.jpg",
"1004": "100315/5065359-R1-19-20_scaled.jpg",
"1008": "images/CNV00016-interim.jpg"}
EDITED: 12 Aug 2016 13:18 by DSMITHHFX