【发布时间】:2011-12-27 14:28:29
【问题描述】:
我正在使用 tokenInput jquery 插件进行自动完成。该脚本运行良好
<script type="text/javascript">
$(document).ready(function () {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "/WebService1.asmx/HelloWorld7",
data: "{}",
dataType: "json",
contentType: "application/json; charset=utf-8",
success: function (data) { $("#<%=demo.ClientID %>").tokenInput("http://shell.loopj.com/tokeninput/tvshows.php");
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(textStatus);
}
});
});
</script>
但是当我换行时
$("#<%=demo.ClientID %>").tokenInput("http://shell.loopj.com/tokeninput/tvshows.php");
与
$("#<%=demo.ClientID %>").tokenInput(data.d);
它显示自动完成,但在按钮单击事件中它显示 demo.Text 为空字符串。我在 firebug 中检查了响应,响应为
{"d":[{"__type":"TestForMySite.fb","Id":1,"name":"ALABAMA"},{"__type":"TestForMySite.fb","Id":2,"name":"ALASKA"}]}
【问题讨论】:
标签: jquery jquery-plugins jquery-autocomplete jquery-tokeninput