百度搜索智能提示案例jsonp
来源:互联网 发布:旋转秋千知乎 编辑:程序博客网 时间:2024/05/19 00:12
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>百度下拉_sug-jquery</title> <script src="jquery-1.11.3.js"></script> <style> #sug{ position: absolute; left: 50%; margin-left: -150px; margin-top: 200px; width: 300px; background: lightGreen; height: 40px; text-align: center; } #sug input{ margin-top: 10px; } #list{ position: absolute; left: 50%; top:50px; width: 200px; margin-left: -150px; margin-top: 200px; height: auto; background: lightBlue; } #list ul{ padding-left: 0px; margin: 0px; } #list ul li{ background: lightGray; line-height: 30px; list-style: none; padding-left: 10px; margin-top: 0px; cursor: pointer; } #list ul li.on{ background: lightGreen; } </style></head><body> <div id="sug"> <div> <input type="text" id="keyWord" autocomplete=off> <input type="button" value="百度一下" id="btn"> </div> </div> <div id="list"> </div> <script> $(function(){ $("#keyWord").keyup(function(e){ var kd = $("#keyWord").val(); var url = 'https://sp0.baidu.com/5a1Fazu8AA54nxGko9WTAnF6hhy/su?wd='+kd; querySUG(url); }); }); function querySUG(url){ document.getElementById('list').innerHTML = ''; $.ajax({ type : "get", async: true, url : url, dataType : "jsonp", jsonp: "cb", jsonpCallback:"callback", success : function(data){ var ul = $("<ul></ul>"); $.each(data.s,function(i,element){ var e = $("<li></li>").append(element); $(ul).append(e); }); $("#list").append(ul); }, error:function(){ console.log('fail'); } }); } </script></body></html>
0 0
- 百度搜索智能提示案例jsonp
- 百度等搜索引擎智能提示(JSONP跨域实现自动补全搜索建议)
- 百度搜狗等搜索引擎智能提示(JSONP跨域实现自动补全搜索建议)
- 百度搜狗等搜索引擎智能提示(JSONP跨域实现自动补全搜索建议)
- 百度搜狗等搜索引擎智能提示(JSONP跨域实现自动补全搜索建议)
- 百度搜索下拉框智能提示功能
- 仿百度智能提示搜索框
- C# 实现百度搜索框智能提示功能
- jQuery 插件 仿百度搜索框智能提示 调用简单!
- C# 实现百度搜索框智能提示功能
- jquery php 百度搜索框智能提示效果
- 仿百度搜索框自动补全智能提示效果
- JSONP实例应用-百度搜索下拉提示和豆瓣书籍搜索
- Jsonp --- 利用Jsonp做百度搜索框
- AJAX小案例:动态搜索提示(仿百度)
- 各大搜索引擎智能提示API (JSONP跨域实现自动补全搜索建议)
- vue2.0,jsonp的一个小案例 请求百度搜索的接口
- 使用 jsonp获取百度搜索提示接口的数据并实时显示
- 三次拉格朗日插值多项式
- 自动驾驶3-百度
- 调用系统摄像头和相册选择图片
- Linux 命令
- Android App的签名打包
- 百度搜索智能提示案例jsonp
- CCF 201604-3 路径解析 题解
- [BZOJ]1026: [SCOI2009]windy数
- 四轴PID讲解
- 在Java中如何高效的判断数组中是否包含某个元素
- SVM hinge loss / SoftMax cross entropy loss
- 创建Hibernate工程时出现"stream not available"和代码提示问题
- STL:string类的简单实现
- Reactor模式和NIO