【发布时间】:2010-11-10 16:05:44
【问题描述】:
我正在尝试使用自动完成脚本 http://www.devbridge.com/projects/autocomplete/jquery/.
现在,下载的代码没有回调脚本。我制作了自己的 PHP 脚本 - 没有用。我正在尝试使用 devbridge 的 serviceUrl(绝对),但这也不起作用。网站上的本地版本(月)也在我的网站上运行。但是有回调的就不行了。
以下是我尝试的步骤:
I) 下载http://www.devbridge.com/projects/autocomplete/jquery/ 目录。
二) 1)方法一:我将index.html中的serviceUrl行改为:
serviceUrl: 'http://www.devbridge.com/projects/autocomplete/service/autocomplete.ashx',
不过,只有本地版本的自动完成功能有效。
(serviceUrl 似乎工作正常 - 在浏览器中尝试 http://www.devbridge.com/projects/autocomplete/service/autocomplete.ashx?query=a。
2) 方法二:我尝试编写自己的 autocomplete.php,但这也不起作用:
<?php
$temp=$_GET["query"];
// Return some dummy data that matches the format.
//json_encode introduces extra quotes ", so I decided to manually format the result
$result="{ query:'$temp',suggestions:['${temp}beria','${temp}byan Arab Jamahiriya','${temp}echtenstein','${temp}thuania'],data:['${temp}lr,'${temp}ly,'${temp}li,'${temp}lt] }";
header('Content-type: application/json');
echo $result;
?>
我检查了每次按键时,都在我的服务器上向 autocomplete.php 发出正确的请求。 (而且“似乎”,php 脚本给出了正确的输出)。但自动完成功能不起作用。
关于如何调试的任何指针?我是否缺少一些文件/模块等?
问候,
日本
【问题讨论】:
标签: php javascript jquery json autocomplete