Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
getJSON&;Mustache.js在?callback=?之后停止工作?_Json_Mustache - Fatal编程技术网

getJSON&;Mustache.js在?callback=?之后停止工作?

getJSON&;Mustache.js在?callback=?之后停止工作?,json,mustache,Json,Mustache,我把我的JSON文件移到了我的http网站上,之后getJSON和mustache就停止工作了 我读到我应该添加?callback=?到我的json url。在那之后,我可以在google chrome inspect网络区域看到一些东西。但我的json仍然没有呈现为html 这是我的代码: <main> <div class="container"> <div id="stream"></div> </

我把我的JSON文件移到了我的http网站上,之后getJSON和mustache就停止工作了

我读到我应该添加?callback=?到我的json url。在那之后,我可以在google chrome inspect网络区域看到一些东西。但我的json仍然没有呈现为html

这是我的代码:

<main>

    <div class="container">

        <div id="stream"></div>

    </div>
</main>

<script id="live" type="text/template">
    {{#videos}}

        <h5>{{header}}</h5>

        <div class="card livestream"> 
           <iframe width="100%" height="100%" src="https://www.youtube.com/embed/{{url}}" frameborder="0" allowfullscreen></iframe>
        </div>

    {{/videos}}
</script>

<!-- Mustache.js -->  
<script src="js/mustache.js"></script>
<script>

        $(function() {

            $.getJSON('externalurl.com/events/json/livestream.json?callback=?', function(data) {
                var template = $('#live').html();
                var html = Mustache.to_html(template, data);
                $('#stream').html(html);
            }); //getjson
        }); //function

</script>

{{{视频}
{{header}}
{{/视频}
$(函数(){
$.getJSON('externalurl.com/events/json/livestream.json?回调=?',函数(数据){
var template=$('#live').html();
var html=Mustache.to_html(模板、数据);
$('#stream').html(html);
});//获取JSON
}); //功能

您是否可以尝试像
$.getJSON('externalurl.com/events/json/livestream.json?callback=?')这样评估函数。完成:函数(数据{})?谢谢你的回复。遗憾的是,我几乎不知道如何使用Javascript来实现这一点。有代码示例吗?这对我很有帮助$(function(){$.getJSON(')。done:function(data{var template=$('#live').html();var html=Mustache.to_html(template,data);$('#stream').html(html);//getJSON});//函数我试过了,但没有成功。我发现,你的语法是错误的。请按照帖子的内容,这里有一个非常像你想要的东西-usinf Flick api