从instagram引用时,ajax函数不起作用

My function seems to return nothing for the destination element when the link is referred to from Instagram. It works fine if I directly visit the page.

 function getTeamsByLeague(league) {
        //console.log("League Set: " + league);
        $.ajax({
            url: "<?php echo SITE_BASE_URL; ?>json.php",
            data: {method: "getteamsbyregion", league: league},
            success: function (data) {
                if (data && data.length > 0) {
                    $("#destination").empty();
                    var selected = "";
                    $.each(data, function (index, item) {

                        if (item.team == teamSelected) {
                            selected = " selected";
                            $("#latitude").val(item.lat);
                            $("#longitude").val(item.lng);
                        } else {
                            selected = "";
                        }
                        $("#destination").append('<option ' + selected + ' value="' + item.lat + ',' + item.lng + '">' + item.team + '</option>');
                        if (index == 0) {
                            $("#latitude").val(item.lat);
                            $("#longitude").val(item.lng);
                        }
                    });
                }
            },
            type: "GET",
            dataType: "json"
        });
    }