Javascript-how should Baidu use this API?

Source: Internet
Author: User
Tags php example
In apistore's popular selection api {code...}, how can I put the returned content and images on the webpage? I am a popular selection api in Cainiao api store.

Interface address: http://apis.baidu.com/txapi/weixin/wxhotrequest method: GET request parameter (header): parameter type required parameter location description default value apikeystring is header API key your own apikey request parameter (urlParam ): parameter name type required parameter location description default value numnumber is urlParam number returned 10 randnumber no urlParam random, 1 represents random 1 wordstring no urlParam search keywords Tomb Stealing Notes pagenumber no urlParam flip, output quantity follows num parameter 1 srcstring no urlParam specified article Source People's Daily request example: curl example php example python example java example C # example ObjectC example Swift Example 1
  
JSON return example: {"code": 200, // return status code "msg": "success", // return status message "newslist": [{"ctime ": "", // article published on "title": "Qihoo 360 Announces Approval of the privatization resolution", // text title "description": "Internet headlines ", // source and description "picUrl ":" http://t1.qpic.cn/mblogpic/f01a972dbcc1060fd456/2000 ", // Article illustration. if it is null, the default" url ":" http://mp.weixin.qq.com/s?__biz=MjM5OTMyODA2MA==&idx=1&mid=402594468&sn=5cd644536b472a283cc1d3f5124a0cab "}, // Article URL {" ctime ":" 2016-03-31 "," title ":" What is the small business doing to earn money? 17 business recommendations "," description ": "Pioneer in entrepreneurship", "picUrl ":" http://zxpic.gtimg.com/infonew/0/wechat_pics_-4225297.jpg/640 "," Url ":" http://mp.weixin.qq.com/s?__biz=MzA3NjgzNDUwMQ==&idx=2&mid=401864059&sn=cfa082e38ba38c7e673b1ce0a075faee "},{" Ctime ":" 2016-03-31 "," title ":" When a poor game turns from an online community to an offline travel service provider, if you start a business, forget about "big platform", "description": "China Travel News", "picUrl ":" http://zxpic.gtimg.com/infonew/0/wechat_pics_-4218551.jpg/640 "," Url ":" http://mp.weixin.qq.com/s?__biz=MzA5MzQyMzQyMw==&idx=3&mid=402488438&sn=88f2d7e415e6d18dafccaa8da549edb6 "},{" Ctime ":" 2016-03-31 "," title ":" When we are old, we will start a store like this. "," description ":" Slow Time ", "picUrl ":" http://zxpic.gtimg.com/infonew/0/wechat_pics_-4225311.jpg/640 "," Url ":" http://mp.weixin.qq.com/s?__biz=MjM5NTIxNTU0MA==&idx=1&mid=405728106&sn=b8ac94b83aa92eea54acf75eff89c657 "},{" Ctime ":" 2016-03-31 "," title ":" Why is the average monthly income of unemployed women over million exposed? "," Description ":" sentences that pass by "," picUrl ":" http://zxpic.gtimg.com/infonew/0/wechat_pics_-4116605.jpg/640 "," Url ":" http://mp.weixin.qq.com/s?__biz=MjM5MTg3OTAzNg==&idx=1&mid=402804635&sn=172aa8f7bf0f8078ade644f46722c561 "},{" Ctime ":" 2016-03-31 "," title ":" What people live in a simple world? "," Description ":" Today's literature "," picUrl ":" http://zxpic.gtimg.com/infonew/0/wechat_pics_-4082011.jpg/640 "," Url ":" http://mp.weixin.qq.com/s?__biz=MjM5ODQxODMyMQ==&idx=1&mid=420440897&sn=cb4b009440b6a9d954bff2a622344e8d "},{" Ctime ":" 2016-03-31 "," title ":" These things make us believe in love. "," description ":" Female Psychology "," picUrl ":" http://zxpic.gtimg.com/infonew/0/wechat_pics_-4225315.jpg/640 "," Url ":" http://mp.weixin.qq.com/s?__biz=MzA3NjM5NDIyMw==&idx=1&mid=401870610&sn=1baf92ad1bb1b9f575027473754551f9 "},{" Ctime ":" 2016-03-31 "," title ":" girly, why do you always look white? "," Description ":" Youth Digest "," picUrl ":" http://zxpic.gtimg.com/infonew/0/wechat_pics_-4225320.jpg/640 "," Url ":" http://mp.weixin.qq.com/s?__biz=MzA5ODEzMTIxOA==&idx=4&mid=405169046&sn=8ea51ec94fcd5d9bed6d1df0d0bf889f "},{" Ctime ":" 2016-03-31 "," title ":" Korean artists come to China to get gold. let's talk about it first. "," description ":" RunningMan ", "picUrl ":" http://zxpic.gtimg.com/infonew/0/wechat_pics_-4225344.jpg/640 "," Url ":" http://mp.weixin.qq.com/s?__biz=MzA3NDcwNzUxMw==&idx=4&mid=403101020&sn=5a9fa497df693b768637faf85f2b6449 "},{" Ctime ":" 2016-03-31 "," title ":" song Zhongji Song Huiqiao frequently heard about song Zhongji "," description ":" Korea Xinnet ", "picUrl ":" http://zxpic.gtimg.com/infonew/0/wechat_pics_-4225352.jpg/640 "," Url ":" http://mp.weixin.qq.com/s?__biz=MjM5MDAzNjYwMA==&idx=4&mid=403617618&sn=3446bb057607d2daf2e3123f837fa24d "}]}

How can I put the returned content and images on the webpage? I'm a newbie.

Reply content:

Popular Selection APIs in api store

Interface address: http://apis.baidu.com/txapi/weixin/wxhotrequest method: GET request parameter (header): parameter type required parameter location description default value apikeystring is header API key your own apikey request parameter (urlParam ): parameter name type required parameter location description default value numnumber is urlParam number returned 10 randnumber no urlParam random, 1 represents random 1 wordstring no urlParam search keywords Tomb Stealing Notes pagenumber no urlParam flip, output quantity follows num parameter 1 srcstring no urlParam specified article Source People's Daily request example: curl example php example python example java example C # example ObjectC example Swift Example 1
  
JSON return example: {"code": 200, // return status code "msg": "success", // return status message "newslist": [{"ctime ": "", // article published on "title": "Qihoo 360 Announces Approval of the privatization resolution", // text title "description": "Internet headlines ", // source and description "picUrl ":" http://t1.qpic.cn/mblogpic/f01a972dbcc1060fd456/2000 ", // Article illustration. if it is null, the default" url ":" http://mp.weixin.qq.com/s?__biz=MjM5OTMyODA2MA==&idx=1&mid=402594468&sn=5cd644536b472a283cc1d3f5124a0cab "}, // Article URL {" ctime ":" 2016-03-31 "," title ":" What is the small business doing to earn money? 17 business recommendations "," description ": "Pioneer in entrepreneurship", "picUrl ":" http://zxpic.gtimg.com/infonew/0/wechat_pics_-4225297.jpg/640 "," Url ":" http://mp.weixin.qq.com/s?__biz=MzA3NjgzNDUwMQ==&idx=2&mid=401864059&sn=cfa082e38ba38c7e673b1ce0a075faee "},{" Ctime ":" 2016-03-31 "," title ":" When a poor game turns from an online community to an offline travel service provider, if you start a business, forget about "big platform", "description": "China Travel News", "picUrl ":" http://zxpic.gtimg.com/infonew/0/wechat_pics_-4218551.jpg/640 "," Url ":" http://mp.weixin.qq.com/s?__biz=MzA5MzQyMzQyMw==&idx=3&mid=402488438&sn=88f2d7e415e6d18dafccaa8da549edb6 "},{" Ctime ":" 2016-03-31 "," title ":" When we are old, we will start a store like this. "," description ":" Slow Time ", "picUrl ":" http://zxpic.gtimg.com/infonew/0/wechat_pics_-4225311.jpg/640 "," Url ":" http://mp.weixin.qq.com/s?__biz=MjM5NTIxNTU0MA==&idx=1&mid=405728106&sn=b8ac94b83aa92eea54acf75eff89c657 "},{" Ctime ":" 2016-03-31 "," title ":" Why is the average monthly income of unemployed women over million exposed? "," Description ":" sentences that pass by "," picUrl ":" http://zxpic.gtimg.com/infonew/0/wechat_pics_-4116605.jpg/640 "," Url ":" http://mp.weixin.qq.com/s?__biz=MjM5MTg3OTAzNg==&idx=1&mid=402804635&sn=172aa8f7bf0f8078ade644f46722c561 "},{" Ctime ":" 2016-03-31 "," title ":" What people live in a simple world? "," Description ":" Today's literature "," picUrl ":" http://zxpic.gtimg.com/infonew/0/wechat_pics_-4082011.jpg/640 "," Url ":" http://mp.weixin.qq.com/s?__biz=MjM5ODQxODMyMQ==&idx=1&mid=420440897&sn=cb4b009440b6a9d954bff2a622344e8d "},{" Ctime ":" 2016-03-31 "," title ":" These things make us believe in love. "," description ":" Female Psychology "," picUrl ":" http://zxpic.gtimg.com/infonew/0/wechat_pics_-4225315.jpg/640 "," Url ":" http://mp.weixin.qq.com/s?__biz=MzA3NjM5NDIyMw==&idx=1&mid=401870610&sn=1baf92ad1bb1b9f575027473754551f9 "},{" Ctime ":" 2016-03-31 "," title ":" girly, why do you always look white? "," Description ":" Youth Digest "," picUrl ":" http://zxpic.gtimg.com/infonew/0/wechat_pics_-4225320.jpg/640 "," Url ":" http://mp.weixin.qq.com/s?__biz=MzA5ODEzMTIxOA==&idx=4&mid=405169046&sn=8ea51ec94fcd5d9bed6d1df0d0bf889f "},{" Ctime ":" 2016-03-31 "," title ":" Korean artists come to China to get gold. let's talk about it first. "," description ":" RunningMan ", "picUrl ":" http://zxpic.gtimg.com/infonew/0/wechat_pics_-4225344.jpg/640 "," Url ":" http://mp.weixin.qq.com/s?__biz=MzA3NDcwNzUxMw==&idx=4&mid=403101020&sn=5a9fa497df693b768637faf85f2b6449 "},{" Ctime ":" 2016-03-31 "," title ":" song Zhongji Song Huiqiao frequently heard about song Zhongji "," description ":" Korea Xinnet ", "picUrl ":" http://zxpic.gtimg.com/infonew/0/wechat_pics_-4225352.jpg/640 "," Url ":" http://mp.weixin.qq.com/s?__biz=MjM5MDAzNjYwMA==&idx=4&mid=403617618&sn=3446bb057607d2daf2e3123f837fa24d "}]}

How can I put the returned content and images on the webpage? I'm a newbie.

Just put it in the corresponding tag ....

You need to understand:

  1. How to send requests in your backend language

  2. What is json and how to use your backend language or JavaScript to parse json

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.