Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
103
rated 0 times [  106] [ 3]  / answers: 1 / hits: 71217  / 14 Years ago, wed, may 5, 2010, 12:00:00

We have javascript files that are environment specific, and so I was thinking of going down the path of creating a generic way to read in an XML (config) file to store different environment specific settings. I was curious to know if anybody else on here does that (or if not, is there a reason why you don't)?


More From » xml

 Answers
7

JSON is hundreds of times faster to consume than XML, bring a native JavaScript object itself. Attach and forget.



EDIT:



James Westgate's example is JSON. You can use this inline or as an external file or even loaded via AJAX.



Here is another example:



var clientData = {}
clientData.dataset1 = [
{name:'Dave', age:'41', userid:2345},
{name:'Vera', age:'32', userid:9856}
]

alert(clientData.dataset1[0].name)

[#96868] Monday, May 3, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
alejandro

Total Points: 231
Total Questions: 102
Total Answers: 107

Location: Jordan
Member since Wed, Jun 17, 2020
4 Years ago
alejandro questions
Mon, Jul 18, 22, 00:00, 2 Years ago
Fri, Sep 18, 20, 00:00, 4 Years ago
Thu, Sep 10, 20, 00:00, 4 Years ago
;