-2
function getData() {
    var photo,
        comment,
        url;

    $.getJSON('http://url.info/verify/settings.php', function (data) {
        photo = data.photoMSG;
        comment = data.commentMSG;
        url = data.photoURL
    });
    console.log(photo); //undefined
    console.log(comment); //undefined
    console.log(url); //undefined
}

それらすべてのコンソールログで未定義になっています... これらの 3 つの変数を getJOSN ブロックの外に表示するにはどうすればよいですか? 私はこれがx100回尋ねられたことを知っています.windiw.varNameを試しましたが、それでも同じことです..

4

2 に答える 2