title: jQuery - variable in ajax success function
body: <p>I am very new to jQuery and would like to use variable <code>name</code> in the success function where it says <code>$(data.name)</code>. Is there anyway to do this? What I'm trying to do is, take the .html file name and then use that to retrieve data from a JSON file. </p>
  
  <pre><code>var url = window.location.pathname;
  var filename = url.substring(url.lastIndexOf('/')+1);
  var name = filename.replace('.html','');
  
  console.log(name);
  
  $.ajax({
    url: '../content.json',
    dataType: 'json',
    type: 'get',
    cache: false,
  
    success: function(data){
      $(data.name).each(function(index, value) {
        $("#title").text(value.title);
        $("#image").attr('src', value.image);
        $("#link").attr('href', value.link);
        $("#link").text(value.linktitle);
      });
    }
  });
  </code></pre>
  
  <p>Here is content.json</p>
  
  <pre><code>{
    "getting_started_in_photography_for_beginners" : {
      "short_title" : "photography",
      "id" : 1,
      "title" : "Getting started in Photography",
      "photo" : "asdfasdf",
      "link" : "fffsdfa"
    },
    "getting_started_in_filmmaking_for_beginners" : {
      "short_title" : "filmmaking",
      "id" : 2,
      "title" : "Getting started in Filmmaking",
      "photo" : "sgasdgw",
      "link" : "gssd"
    }
  }
  </code></pre>