Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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();
      });
    }
  };