Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript

Adding webpage links to a json file

How do I format my links to get them to work on my site in the below JSON file? When I click the links it opens up another tab that goes to the site to which I am trying to show the links below on but not to the link sites themselves.

[
   {
      "title":"Portfolio Site",
      "projectUrl":"www.amandeepd.com",
      "description":"This portfolio site contains mini projects that I have completed over time.",
      "date":"2015-10-14"
   },
   {
      "title":"Lake Tahoe Landing Page",
      "projectUrl":"www.amandeepd.com/LakeTahoe/LakeTahoe.html",
      "description":"This project showcases CSS tricks that I was learning at the time.",
      "date":"2015-9-10"
   },
   {
      "title":"Frogs and Logs",
      "projectUrl":"www.amandeepd.com/FrogsandLogs2/index.html",
      "description":"An interactive game I built using C# and the Unity Game Engine.",
      "date":"2015-11-22"
   }
]
'''

Hey Amandeep , i think u should set the AJAX like that if you want to load the following html page below any div of your page

$("#ajax").load('url'); //url of page you want to display

can you paste your AJAX so we can help you in better way ...

liam johnshon appreciate the reply. Ive posted my AJAX below.

Project.fetchAll = function() {
    if (localStorage.projectData) {
      Project.loadAll(JSON.parse(localStorage.projectData));
      ProjectView.initIndexPage();
    } else {
      $.get('data/projectData.json', function(data) {
        Project.loadAll(data);
        var dataString = JSON.stringify(data);
        localStorage.setItem('projectData', dataString);
        ProjectView.initIndexPage();
      });
    }
  };