Vanilla 开发:异步调用最新的20条帖子

How to show last 20 topics on other web pages

I’m going to help you get started with some javascript that we’ve done for a client.

Please note that this script uses jQuery so you’ll need to include that in your page as well. It is a very common library and should work. You should really know javascript and jQuery a little bit or you’ll be flying blind though.

Notes

1. Notice that the url looks very similar to the url that your browse to when viewing the forum normally. The only difference is that it has a .json?page=1-20&callback=? on the end. This is the API in action and you can call most urls that way.

2. If you want to figure out what kind of data is returned from the API I recommend getting the excellent JSONView Firefox extension . Once you’ve installed this you can copy that api url into your browser and have a look at what comes out. If you don’t install JSONView you can still look at the url, but you will be prompted to download.

refer to: http://vanillaforums.org/discussion/17968/how-to-show-last-20-topics-on-other-webpages

评论已关闭。Comments are turned off for this article.