常用Api地址:
Google(备用)
Api地址:http://google.com/complete/search?output=toolbar&q=%设计
<toplevel>
<CompleteSuggestion>
<suggestion data="设计"/>
</CompleteSuggestion>
<CompleteSuggestion>
<suggestion data="设计师"/>
</CompleteSuggestion>
<CompleteSuggestion>
<suggestion data="设计网"/>
</CompleteSuggestion>
<CompleteSuggestion>
<suggestion data="设计思维"/>
</CompleteSuggestion>
<CompleteSuggestion>
<suggestion data="设计本"/>
</CompleteSuggestion>
<CompleteSuggestion>
<suggestion data="设计素材"/>
</CompleteSuggestion>
<CompleteSuggestion>
<suggestion data="设计师平台"/>
</CompleteSuggestion>
<CompleteSuggestion>
<suggestion data="设计公司"/>
</CompleteSuggestion>
<CompleteSuggestion>
<suggestion data="设计是什么"/>
</CompleteSuggestion>
<CompleteSuggestion>
<suggestion data="设计癖"/>
</CompleteSuggestion>
</toplevel>
百度
Api地址:http://suggestion.baidu.com/su?wd=设计&p=3&cb=window.bdsug.sug
window.bdsug.sug({q:”设计”,p:false,s:[“设计之家”,“设计素材下载”,“设计签名”,“设计在线”,“设计师”,“设计英才网”,“设计软件”,“设计兵团”,“设计公司”,“设计说明”]});
搜狗
Api地址:http://w.sugg.sogou.com/sugg/ajaj_json.jsp?key=设计&type=web
window.sogou.sug([“设计”,[“设计之家”,“设计英才网”,“设计在线”,“设计签名”,“设计师”,“设计兵团”,“设计网站”,“设计软件”,“设计网”,“设计中国”]],-1);
淘宝
Api地址:http://suggest.taobao.com/sug?area=etao&code=utf-8&callback=KISSY.Suggest.callback&q=设计
KISSY.Suggest.callback({“result”: [[“设计师品牌 -原创”, “55740”], [“设计师”, “229765”], [“设计素材”, “49096”], [“设计感”, “32436”], [“设计师品牌”, “56416”], [“设计猫”, “22815”], [“设计师品牌女装”, “3603”], [“设计前线”, “933”], [“设计logo”, “54977”], [“设计阶段”, “301”]],”etaobook”:[[“设计中的色彩心理学”,“2346799”,“金容淑”,“人民邮电出版社”,“2011-1-1”], [“设计语言:经典标志设计密码(附光盘)”,“1840962”,“埃瓦米”,“华中科技大学出版社”,“2009-2-1”], [“设计密码(如何成为一名优秀的职业设计师)”,“1845460”,“魏来”,“中信出版社”,“2010-4-1”], [“设计观点”,“2401723”,“祝帅”,“辽宁科学技术出版社”,“2010-9-1”], [“设计的品格-探索×呈现×进化的InDesign美学”,“2239663”,“叶立群”,“人民邮电出版社”,“2010/9/1”]]})
雅虎
Api地址:http://s.aliyun.com/ajax.php?format=jsonp&q=设计
Proxy(“suggest_show”,["\u8bbe\u8ba1\u53f2","\u8bbe\u8ba1\u6807\u5fd7","\u8bbe\u8ba1\u8f6f\u4ef6\u57f9\u8bad","\u8bbe\u8ba1\u8bf4\u660e","\u8bbe\u8ba1\u6784\u6210","\u8bbe\u8ba1\u7406\u5ff5","\u8bbe\u8ba1\u4e4b\u5bb6","\u8bbe\u8ba1\u7684\u6539\u9769","\u8bbe\u8ba1\u4e00\u5ea7\u6865","\u8bbe\u8ba1 \u767e\u4e8b\u901a"]);
必应
Api地址:http://sg1.api.bing.com/qsonhs.aspx?type=cb&cb=callback&q=设计
if(typeof callback == ‘function’) callback({“AS”:{“Query”:”设计”,”FullResults”:1,”Results”:[{“Type”:“AS”,“Suggests”:[{“Txt”:“设计之家”,“Type”:“SF”},{“Txt”:“设计之家”,“Type”:“AS”},{“Txt”:“设计在线”,“Type”:“AS”},{“Txt”:“设计签名”,“Type”:“AS”},{“Txt”:“设计师”,“Type”:“AS”},{“Txt”:“设计软件”,“Type”:“AS”},{“Txt”:“设计网”,“Type”:“AS”},{“Txt”:“设计模式”,“Type”:“AS”}]}]}} /* pageview_candidate */);
使用方法:
除Google的Api接口返回的数据类型为XML,其余的返回类型均为 jsonp
。以淘宝搜索联想Api为例,用Ajax接收数数据后的处理方式如下:
var getSearchData = function (search_str) {
$.ajax({
type: "GET",
url: "https://suggest.taobao.com/sug?area=etao&code=utf-8&callback=search_data&q=" + search_str,
dataType: "jsonp",
jsonpCallback: "search_data",
success: function (data) {
console.log(data)
});
}
getSearchData('牛');