The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Function returns undefined

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #234778

    Hello, i got this function

    function get_twitchpic(ch_name){
    var api = “” + ch_name;
    $.getJSON(api, function(json) {
    var logo= json[“logo”];
    return logo;

    located in function.js; If i put a console.log before the return it gives me the correct link, however, when i call that function from index.php and store it like this:
    var pic = get_twitchpic(‘liftingnerdbro’);
    it says that pic is undefined. can somebody help me?


    Let me refer to this (third answer looks easiest)…

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.