如何获取JavaScript查询以HTML格式显示结果

时间:2015-07-01 10:31:01

标签: javascript html google-chrome-extension

嘿我试图让我的查询结果显示在我的网页上,我怎样才能实现呢?

我通过json.manifest在oddschecker页面上运行这个:http://www.oddschecker.com/horse-racing/thirsk/14:00/winner,所以我希望能够通过chrome扩展来运行它,我怎样才能将javascript函数显示为一个html页面??

<html>
<title>I am not very good.</title>
 <head>
  <script type="text/javascript">
var odds = $('.co');
odds.each(function(){
    var id = $(this).attr('id');
    if(id.indexOf('_B3') >= 0){
        console.log(id);
        //your code here
    }
});}
</script>
 </head>
<body>
<div id="oddschecker"></div>
 </body>
</html>

1 个答案:

答案 0 :(得分:0)

<html>
    <title>I am not very good.</title> 

    <head> 
        <script type="text/javascript"> 
        var odds = $('.co');
        odds.each(function() {
            var id = $(this).attr('id');

            if(id.indexOf('_B3') >= 0) {
                console.log(id);
                $('#oddschecker').html(data); // data is the retrieval data
            }
        });
     }
     </script> 
</head> 
<body>
    <div id="oddschecker"></div> 
</body> 
</html>