title: Load JSON data if file exists in directory.
body: <p>I'm going to do my best to explain this question, But it will no doubt become confusing, I have been looking for about 3 days now with no luck, so its either not possible, or so simple that no one has needed to ask.</p>
  
  <p>Basically, I have a folder in the root of my web server that contains a changing amount of images, What I want to do is scan that folder with jquery and load the images into a html page, which I have accomplished, and it works flawlessly, but I need it to do more, </p>
  
  <p>I have a json file that looks something like this...</p>
  
  <pre><code>[{
      "gamename": "GAME1",
      "gameimage": "GAME1.jpg",
      "orientation": "horizontal"
  },
  {
      "gamename": "GAME2",
      "gameimage": "GAME2.jpg",
      "orientation": "horizontal"
  },
  </code></pre>
  
  <p>what I need it to do is search the image folder for images, if it finds an image, load it into a html page (which I am able to do at the moment) and then find the corresponding json data for that game image and show it underneath the loaded image. </p>
  
  <p>This is my current code that is scanning the folder and loading jpg images. </p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;script type="text/javascript" src="resources/jquery-1.9.1.min.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div class="l-content"&gt;
      &lt;div class="cell pure-g"&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;script&gt;
  var dir = "/images/";
  var fileextension = ".jpg";
  $.ajax({
      url: dir,
      success: function (data) {
          $(data).find("a:contains(.jpg)").each(function () {
              var filename = this.href.replace(window.location.host, "").replace("http:///", "");
              $(".pure-g").append($("&lt;img class=\"game-img\" src=" + dir + filename + "&gt;&lt;/img&gt;&lt;br&gt;"
              ));
          });
      }
  });
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Any help would be very much appreciated, I know its probably not the most understandable question so I will try to clear anything up if needed.</p>