0

I am hanging with this problem: I am trying to get the JSON file from http://finance.google.com/finance/info?client=ig&q=NASDAQ:TSLA with this code:

$("document").ready(function () {
    // Calling function
    reLoad();

    function reLoad() {
        $.getJSON("http://finance.google.com/finance/info?client=ig&q=NASDAQ:TSLA", function(data) {
            alert(data);
        });

        setTimeout(reLoad, 1000);
    };
});

But this isn't working. Any ideas?

2 Answers 2

2

You need to define the function before you call it, or it won't work.

In this case, that means you need to write reLoad(); after function reLoad() { ... } instead of before.

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

1 Comment

@Jaumzera Please do not use backticks (code) for emphasis.
0

Thanks for your respond, but when i am testing my code with another json file it works! So my problem is just getting this spezial file from the url "http://finance.google.com/finance/info?client=ig&q=NASDAQ:TSLA", which looks like this:

// [ { "id": "12607212" ,"t" : "TSLA" ,"e" : "NASDAQ" ,"l" : "216.22" ,"l_fix" : "216.22" ,"l_cur" : "216.22" ,"s": "1" ,"ltt":"4:00PM EDT" ,"lt" : "May 23, 4:00PM EDT" ,"lt_dts" : "2016-05-23T16:00:01Z" ,"c" : "-4.06" ,"c_fix" : "-4.06" ,"cp" : "-1.84" ,"cp_fix" : "-1.84" ,"ccol" : "chr" ,"pcls_fix" : "220.28" ,"el": "217.50" ,"el_fix": "217.50" ,"el_cur": "217.50" ,"elt" : "May 24, 7:52AM EDT" ,"ec" : "+1.28" ,"ec_fix" : "1.28" ,"ecp" : "0.59" ,"ecp_fix" : "0.59" ,"eccol" : "chg" ,"div" : "" ,"yld" : "" } ]

Do you have any ideas how to get this? Best wishes, Vinc

Comments

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.