title: How to pass json data to .js files
body: <p>i got a problem here .</p>
  
  <p>I have this code to create the json data in locations.php</p>
  
  <pre><code>&lt;?php
      $locations = array(
              array('2479 Murphy Court', "Minneapolis, MN 55402", "$36,000", 48.87, 2.29, "property-detail.html", "assets/img/properties/property-01.jpg", "assets/img/property-types/apartment.png"),
              array('3398 Lodgeville Road', "Golden Valley, MN 55427", "$28,000", 48.866876, 2.309639, "property-detail.html", "assets/img/properties/property-02.jpg", "assets/img/property-types/apartment.png")
          );
  ?&gt;
  
  &lt;script type="text/javascript"&gt;
      var locations = "&lt;?= json_encode($locations) ?&gt;";
  &lt;/script&gt;
  </code></pre>
  
  <p>I want to pass the json to locations.js . Which it will called by another .js file with getScript function. I tried to call the locations.php but its not working, so i create locations.js to test and it works</p>
  
  <p>Not working</p>
  
  <pre><code>$.getScript("assets/php/locations.php", function(){
  </code></pre>
  
  <p>Working</p>
  
  <pre><code>$.getScript("assets/js/locations.js", function(){
  </code></pre>
  
  <p>locations.js</p>
  
  <pre><code>var locations = [
      ['2479 Murphy Court', "Minneapolis, MN 55402", "$36,000", 48.87, 2.29, "property-detail.html", "assets/img/properties/property-01.jpg", "assets/img/property-types/apartment.png"],
      ['3398 Lodgeville Road', "Golden Valley, MN 55427", "$28,000", 48.866876, 2.309639, "property-detail.html", "assets/img/properties/property-02.jpg", "assets/img/property-types/apartment.png"],
  ];
  </code></pre>
  
  <p>Can anyone help me? Thank you.
  Sorry for bad english and maybe hard to understand</p>