首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >尝试检查mootools中是否存在youtube视频时出错

尝试检查mootools中是否存在youtube视频时出错
EN

Stack Overflow用户
提问于 2011-06-29 23:36:31
回答 1查看 306关注 0票数 0

我有这个代码

代码语言:javascript
复制
 var x = 'http://gdata.youtube.com/feeds/api/videos/FLE2htv9oxc';
        var myJSONP = new Request.JSONP({
            url: x,
            callbackKey: 'jsoncallback',
            data: ({ partTag: is_youtube }),              
            onRequest: function (url) {
                // a script tag is created with a src attribute equal to url
            },
            onComplete: function (data) {
                // the request was completed.
                alert("ok");
            }
        }).send();

我试着验证youtube视频是否存在,我一直收到这个错误

缺少;此错误的语句中断前...ount='193‘viewCount='19488'/>

arrr..我做错了什么?有没有其他方法来验证url?

EN

回答 1

Stack Overflow用户

发布于 2011-06-30 05:12:09

你需要告诉它使用v2和jsonp。按照原样,它返回xml...

代码语言:javascript
复制
var x = 'http://gdata.youtube.com/feeds/api/videos/FLE2htv9oxc?v=2&alt=jsonc';
var myJSONP = new Request.JSONP({
    url: x,
    log: true,
    onRequest: function(url) {
        // a script tag is created with a src attribute equal to url
    },
    onComplete: function(data) {
        // the request was completed.
        console.log(data);
    }
}).send();

http://jsfiddle.net/ZD9Y6/证明。

参考

http://code.google.com/apis/youtube/2.0/reference.html#Video_Feeds

http://code.google.com/apis/youtube/2.0/developers_guide_json.html

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6523296

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档