最近在搞下新浪微博APP开发应用,这个示例之获取指定微博账户的微博内容记录
<
html
>
< head >
< title > 新浪微博APP开发应用示例之获取指定微博账户的微博内容记录 </ title >
< script type ="text/javascript" src ="http://js.wcdn.cn/t3/platform/js/api/wb.js" charset ="utf-8" ></ script >
< script type ="text/javascript" src ="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" ></ script >
</ head >
< body >
微博ID: < input type ="text" id ="id" />< br />
提取微博的数量(最多20条): < input type ="text" id ="num" />< br />
< input type ="button" onclick ="testt($('#id').val(),$('#num').val());" value ="button" />
</ body >
< script type ="text/javascript" >
WB.core.load([ ' connect ' , ' client ' ], function () {
var cfg = {
key: ' 3274830762 ' ,
xdpath: ' sina.html '
};
WB.connect.init(cfg);
WB.client.init(cfg);
});
function testt(id,num){
$.ajax({
url: " http://api.t.sina.com.cn/statuses/user_timeline.json " ,
data: " source=941123049&user_id= " + id, // "method=read", //$("#textBox1").children().serialize()
// source 处是appkey
dataType: " jason " ,
type: " POST " ,
success: function (data) {
// alert(data.length);
var t = eval( ' ( ' + data + ' ) ' );
// alert(data);
// alert(t.length);
if (num > 20 )
{
num = 20 ;
}
for (i = 0 ;i < num ;i ++ )
{
$( " body " ).append( " <br/> " + " [ " + i + " ] " + t[i].text + " <br/> " );
}
}
} );
}
</ script >
</ html >
< head >
< title > 新浪微博APP开发应用示例之获取指定微博账户的微博内容记录 </ title >
< script type ="text/javascript" src ="http://js.wcdn.cn/t3/platform/js/api/wb.js" charset ="utf-8" ></ script >
< script type ="text/javascript" src ="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" ></ script >
</ head >
< body >
微博ID: < input type ="text" id ="id" />< br />
提取微博的数量(最多20条): < input type ="text" id ="num" />< br />
< input type ="button" onclick ="testt($('#id').val(),$('#num').val());" value ="button" />
</ body >
< script type ="text/javascript" >
WB.core.load([ ' connect ' , ' client ' ], function () {
var cfg = {
key: ' 3274830762 ' ,
xdpath: ' sina.html '
};
WB.connect.init(cfg);
WB.client.init(cfg);
});
function testt(id,num){
$.ajax({
url: " http://api.t.sina.com.cn/statuses/user_timeline.json " ,
data: " source=941123049&user_id= " + id, // "method=read", //$("#textBox1").children().serialize()
// source 处是appkey
dataType: " jason " ,
type: " POST " ,
success: function (data) {
// alert(data.length);
var t = eval( ' ( ' + data + ' ) ' );
// alert(data);
// alert(t.length);
if (num > 20 )
{
num = 20 ;
}
for (i = 0 ;i < num ;i ++ )
{
$( " body " ).append( " <br/> " + " [ " + i + " ] " + t[i].text + " <br/> " );
}
}
} );
}
</ script >
</ html >
文章来源:合肥网产品中心
本文:http://lab.wehefei.com/posts/285
更多,欢迎来访问。