jQuery:Yahoo Autocomplete / Autosuggest(jQuery: Yahoo Autocomplete/Autosuggest)
我试图检索雅虎自动填充。
雅虎的JSON网址是这样的: http : //ff.search.yahoo.com/gossip?output=fxjson&command=query
所以我有:
$("selector").autocomplete({ source: function( request, response ) { $.ajax({ url: "http://ff.search.yahoo.com/gossip", dataType: "jsonp", data: { "output" : "fxjson", "command" : request.term }, success: function( data ) { response(data[1]) } }) } });
这里是一个例子: http : //jsfiddle.net/yQbdb/
有人能发现一个错误,或者我做错了什么? 它应该工作。
谢谢
I'm trying to retrieve yahoo autocomplete.
Yahoo's JSON url is this: http://ff.search.yahoo.com/gossip?output=fxjson&command=query
So I have:
$("selector").autocomplete({ source: function( request, response ) { $.ajax({ url: "http://ff.search.yahoo.com/gossip", dataType: "jsonp", data: { "output" : "fxjson", "command" : request.term }, success: function( data ) { response(data[1]) } }) } });
And here is an example: http://jsfiddle.net/yQbdb/
Can someone spot a mistake or what I'm I doing wrong? It should work.
Thanks
原文:https://stackoverflow.com/questions/8380623
最满意答案
1)谢谢你的“EXPLAIN”。 我们所有人(包括你,我敢肯定) 知道问题是mysql必须将整数转换为字符串,并且必须为每一行执行此操作。 但你的“EXPLAIN”证明了这一点。
2)这是一篇关于EXPLAIN的简短文章:
* possible_keys *显示哪些索引适用于此查询,并且键告诉我们实际使用了哪些-...最后, rows条目告诉我们MySQL必须查看多少行才能找到结果集。
Search value: key: type: ref: rows: ------------- --- ---- ---- ---- 5107357058 NULL ALL NULL 6482116 '5107357058' phoneNumber ref const 2
3)“ref”列是“与索引相比的列”。 在第二种情况下,将字符串文字(“常量”)'5107357058'与键“phoneNumber”进行比较。 在第一种情况下,没有可用的密钥(因为您的搜索条件是完全不同的类型); 因此“ref”为NULL。
4)“类型”列是“连接类型”。 “Ref”表示“从该表中读取具有匹配索引值的所有行”(在本例中为2行)。 “ALL”勒芒“全表扫描”。 在这种情况下,这意味着600万行。
5)这是“EXPLAIN”的mysql文档:
1) Thank you for the "EXPLAIN". We all (including you, I'm sure) knew that the problem was that mysql had to convert the integer to a string, and had to do it for each row. But your "EXPLAIN" proved it.
2) Here's a nice, short article about EXPLAIN:
The *possible_keys* shows which indexes apply to this query and the key tells us which of those was actually used -... Finally the rows entry tell us how many rows MySQL had to look at to find the result set.
Search value: key: type: ref: rows: ------------- --- ---- ---- ---- 5107357058 NULL ALL NULL 6482116 '5107357058' phoneNumber ref const 2
3) The "ref" column is the "The columns compared to the index". In the second case, the string literal ("constant") '5107357058' was compared to the key "phoneNumber". In the first case, there was no usable key (because your search condition was a completely different type); hence "ref" was NULL.
4) The "type" column is "The join type". "Ref" means "All rows with matching index values are read from this table" (in this case, 2 rows). "ALL" mans "full table scan". Which in this case means 6 million rows.
5) Here's the mysql documentation for "EXPLAIN":
相关问答
更多-
也许没有人会认为你需要这么高的超时时间,所以你只限于目前可设置的内容。 但是在http://bugs.mysql.com上打开一个功能请求,建议将0完全禁用超时或允许更大的值。 Probably nobody ever thought you'd need such a high timeout, so you are limited to what is settable currently. But open a feature request on http://bugs.mysql.com to s ...
-
这个问题以前一直存在 ,答案总是一样的:不同的SET选项或参数嗅探。 我怀疑set QUOTED_IDENTIFIER ON 。 你为什么要运行这个陈述? 确保SSMS和您的应用的QUOTED_IDENTIFIER设置始终相同。 它可能应该ON任何地方ON 。 通过使用SSMS编写脚本并对"QUOTED_IDENTIFIER OFF"进行文本搜索来审核数据库。 那应该不存在。 This question has been there before and the answer is always the s ...
-
可能是一些问题: 检查操作系统是否与SQL 2008相同。 检查内存SQL SERVER: 右键单击: 服务器属性 - > 内存 - > 最大服务器内存 有时,虚拟团队为了另一台机器的利益而降低CPU消耗(如果这是虚拟机)。 Could be some problems: Check the operating system is the same data SQL 2008. Check the memory SQL SERVER: Right-click: Server properties -> Me ...
-
1)谢谢你的“EXPLAIN”。 我们所有人(包括你,我敢肯定) 知道问题是mysql必须将整数转换为字符串,并且必须为每一行执行此操作。 但你的“EXPLAIN”证明了这一点。 2)这是一篇关于EXPLAIN的简短文章: http://www.lornajane.net/posts/2011/explaining-mysqls-explain * possible_keys *显示哪些索引适用于此查询,并且键告诉我们实际使用了哪些-...最后, rows条目告诉我们MySQL必须查看多少行才能找到结果集。 ...
-
试试这种方式: SELECT DISTINCT user.id, user.name FROM user INNER JOIN `webchat` on user.id = `webchat`.user_id WHERE `webchat`.closed = 0 Try this way: SELECT DISTINCT user.id, user.name FROM user INNER JOIN `webchat` on user.id = `webchat`.user_id WHE ...
-
这是一个已知的问题,将在.NET 4.0中解决 。 当您第一次运行基于Web的应用程序时,代码必须被缓存。 从此,它全速运转。 本文将介绍当前通过在第一个用户访问该服务之前预先运行代码来避免此初始减速的方法。 This is a known problem that will be resolved with .NET 4.0. When you first run a web based application, the code must be cached. From then on, it runs ...
-
您应该将GOMAXPROCS环境变量设置为最大可用处理器数。 或者在执行时使用函数GOMAXPROCS 。 You should set GOMAXPROCS environment variable for go to the maximum number of usable processors. Or use function GOMAXPROCS at executing time.
-
我以前见过这个,并通过使用参数表而不是变量来解决它。 if object_id('myParameters') is not null drop table myParameters Select cast('1996-05-01' as datetime) as myDate into myParameters Select * from TempTable where effdate = (select max(myDate) from myParameters) I've seen this be ...
-
使用try-catch包围代码: try { $command = Yii::app()->db->createCommand($sql); $command->execute(); } catch(CDbException $e) { echo "Got exception:" . $e->getMessage(); } Surround your code with try-catch: try { $command = Yii::app()->db->creat ...
-
MATLAB:嵌套for循环每次连续迭代都需要更长的时间(MATLAB: Nested for-loop takes longer every successive iteration)[2022-08-22]
因此,当我用以下代码替换if语句时,问题基本上消失了: if mod(i,1e4) == 0 % only for demonstration, not in final script fprintf(1,'time for last 10000 iterations: %f \n',toc); tic; end 我认为对toc的操作可能会导致问题 So, the problem gets largely eliminated when I replace the if statement wit ...