Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/384.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/88.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
Javascript YQL-无法返回YQL结果_Javascript_Jquery_Yql - Fatal编程技术网

Javascript YQL-无法返回YQL结果

Javascript YQL-无法返回YQL结果,javascript,jquery,yql,Javascript,Jquery,Yql,我想把所有的钱都还给你 我正在使用rest查询的页面上的超链接 这是我使用的yql查询 select * from html where url="http://www.stickam.com/videoPlaylist.do?uId=182005497" and xpath="//*[@class='mediaThum']/a" 这是密码 <script src="jquery.1.6.1.js"></script> <script> $(docume

我想把所有的钱都还给你

我正在使用rest查询的页面上的超链接

这是我使用的yql查询

select * from html where url="http://www.stickam.com/videoPlaylist.do?uId=182005497" and xpath="//*[@class='mediaThum']/a"

这是密码

<script src="jquery.1.6.1.js"></script>
<script>

$(document).ready(function(){
    var yql = "http://query.yahooapis.com/v1/public/yql?q=%20SELECT%20*%20FROM%20html%20WHERE%20url%3D%22http%3A%2F%2Fwww.stickam.com%2FvideoPlaylist.do%3FuId%3D182005497%22%20and%20xpath%3D%22%2F%2F*%5B%40class%3D'mediaThum'%5D%2Fa%22%20";

    $.get( yql, cbFunc );

    function cbFunc(data) {

    alert(data.query.results.a[0].href);

    }//END FUNC
});//end document.ready
</script>

$(文档).ready(函数(){
变量yql=”http://query.yahooapis.com/v1/public/yql?q=%20SELECT%20*%20从%20html%20其中%20url%3D%22http%3A%2F%2Fwww.stickam.com%2FvideoPlaylist.do%3FuId%3D182005497%22%20和%20xpath%3D%22%2F%2F*%5B%40class%3D'mediaThum“%5D%2Fa%22%20”;
$.get(yql,cbFunc);
函数cbFunc(数据){
警报(data.query.results.a[0].href);
}//结束函数
});//结束文件.ready

谢谢Anthony。

有几个小问题,我只讨论其中的几个

  • 从YQL请求JSON

    您需要告诉YQL,您希望查询得到JSON格式的响应。YQL url必须包含
    format=json

    var yql = "http://query.yahooapis...%22%20&format=json";
    
  • 从jQuery请求JSON

    使用
    $.getJSON
    函数代替
    $.get


+将回调参数添加为“?”您知道如何从中提取web内容吗?