title: Error getting json file
body: <p>I have an javascript file that is meant to get the json file and if it's successful, it would perform a function and if it's not, it would show an alert window saying "error", but although the syntax looks correct, I am getting an alert window with error everytime.</p>
  
  <p>these are the two files</p>
  
  <pre><code>var firstName = [];
  var lastName = [];
  var email = [];
  var password = [];
  var i;
  
  function insertRecord() {
  $.ajax({
      type: "GET",
      url: "studio.json",
      dataType: "json",
      success: insertData,
      error: function(){ alert("error"); }
  });
  
  function insertData(data) {
      if (localStorage) {
          for (i = 0; i &lt; data.User.length; i++) {
              localStorage.setItem(firstName[i], data.User.firstName[j]);
              localStorage.setItem(lastName[i], data.User.lastName[j]);
              localStorage.setItem(email[i], data.User.email[j]);
              localStorage.setItem(password[i], data.User.password[j]);
          }
  
          localStorage.setItem(firstName[i], document.getElementById("firstName").value);
          localStorage[firstName[i]] = document.getElementById("firstName").value;
          localStorage.setItem(lastName[i], document.getElementById("lastName").value);
          localStorage[lastName[i]] = document.getElementById("lastName").value;
          localStorage.setItem(email[i], document.getElementById("email").value);
          localStorage[email[i]] = document.getElementById("email").value;
          localStorage.setItem(password[i], document.getElementById("password").value);
          localStorage[password[i]] = document.getElementById("password").value;
  
          alert(localstorage[firstName]);
      }
  
      else
          alert("Your browser does not support Local Storage");
  }
  </code></pre>
  
  <p>}</p>
  
  <p>The json file is called studio.json<br /></p>
  
  <pre><code>{
      "Students":[
             { "first":"Arnold", "last":"Matthews", "class":"Tiny Tutus" },
             { "first":"Keesha", "last":"Franklin", "class":"Breakdancing"},
             { "first":"Dorothy", "last": "Ann", "class":"Acro"},
             { "first":"Wanda", "last": "Li", "class":"Ballet"},
             { "first":"Phoebe", "last": "Terese", "class":"Tap"}
      ],
      "Classes":[
          { "name":"Tiny Tutus", "time":"450","AMPM":"PM", "students":12},
          { "name":"Breakdancing", "time":"230","AMPM":"PM", "students":6},
          { "name":"Acro", "time":"810","AMPM":"AM", "students":15},
          { "name":"Tap", "time":"520","AMPM":"PM", "students":11},
          { "name":"Ballet", "time":"620","AMPM":"PM", "students":15},
          { "name":"Jazz", "time":"740","AMPM":"AM", "students":8 }
      ],
      "User":[
          {
          "firstName": "Michael",
          "lastName": "Jones",
          "username": "MJone",
          "email": "Michael.Jones@email.com",
          "password": "qwerty"
          },
          {
          "firstName": "Michelle",
          "lastName": "Lee",
          "username": "MLee",
          "email": "Michelle.Lee@gmail.com",
          "password": "asdfgh"
          },
          {
          "firstName": "Andrew",
          "lastName": "Bob",
          "username": "ABob",
          "email": "Andrew.Bob@hotmail.com",
          "password": "zxcvbn"
          }
      ]
  }
  </code></pre>