0

I'm looking into dynamically using data from an external json file into my javascript. I must have misunderstood how to call the file because for the moment I can't even access the data... So theres my html calling the js file. and the js file calls the json using this method :

$(function() {
    function stockTimeline(){
        $.getJSON('json/corse_timeline/corse_timeline.json', function(donnees) {
            $('#wrap').html('<p>' + donnees.timeline.date[4].endDate + '</p><p>' + donnees.timeline.date[9].startDate + '</p><p>' + donnees.timeline.headline + '</p><p>' + donnees.timeline.date[30].headline + '</p><p>');
            console.log("this console.log IS NOT working");
        });
        console.log("this console.log IS working");
    }
    stockTimeline(); 
});

I've taken this method right out of several tutorials I've read. How can I test if my json file is corrupted? Is it because I need to upload it on a server for it to work?

1
  • Does the console show any javascript errors? Commented May 21, 2013 at 17:35

1 Answer 1

4

You can verify your JSON file by pasting it into JSON Lint.

Sign up to request clarification or add additional context in comments.

2 Comments

I do have tons of parse error! thanks for the link, I'm correcting it right now ;)
Handy stuff. Sometimes you just need fresh eyeballs, even if they are those of a machine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.