Hi,
I have an array object, The format like:
templates = [
{"templateName":"Temp001.docx","templateId":"DOC001"},
{"templateName":"Temp002.docx","templateId":"DOC002"},
{"templateName":"Temp003.docx","templateId":"DOC003"}]
I want to get templateName and templateId respectively. My JS code like:
var Name, Value;
for (var i = 0; i < templates.length; i++) {
Name = templates[i].templateName;
Value = templates[i].templateId;
alert ('Temlate Name: ' + Name, 'Template ID: ' + Value);
}
But it's not work. Could you please help to correct the code above? Thanks.
Thanks, it's work now.
Hi,
It works when I try on my browser.
Problem is with your alert
Change to
alert('Template Name: ' + Name + ' Template Value: ' + Value);
Only thing to note is in your variable Name and Value will have last item value.
Adis
136
Super User 2025 Season 1
Sohail Ahmed
81
Jonas "Jones" Melgaard
77
Super User 2025 Season 1