Click here to Skip to main content
15,851,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I need help trying to load a JsonData.json file into a javascript array.
My JsonData.json file structure is below:
        "ID": 1,
        "Name": "John Smith",
        "IDNumber": "7606015012088"
        "ID": 2,
        "Name": "Molly Malone",
        "IDNumber": "8606125033087"
        "ID": 3,
        "Name": "Rianna Chetty",
        "IDNumber": "6207145122087"

I am using the code below but I am getting an error: 'myList' is undefined
   .done(function (data) {
       myList = data;
Updated 25-Oct-13 5:09am
Prasad Khandekar 25-Oct-13 10:12am    
Where in your file this variable (myList) is declared?
Linkz_G 25-Oct-13 10:20am    
the name of my array needs to be called myList
Prasad Khandekar 25-Oct-13 10:31am    
Yes, but in your script you need to have the declaration. Try changing your code to something like one shown below.

var myList;
.done(function (data) {
myList = data;

Yes, this will solve the issue.
Member 13769644 24-Aug-18 5:51am    
what is $.
it get me error $ not define

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900