我有文本框名称txtEmailList,我提供了自动完成列表,
<asp:TextBox runat="server" ID="txtEmailList" CssClass="txtAutoComplete">
Run Code Online (Sandbox Code Playgroud)
自动完成的脚本
$('#txtEmailList').autocomplete({
source: function(request, response) {
// this is the ajax call, which is running successfully
var msg =
Assessments_JqueryAutoComplete.AutoComplete(request.term).value; //(ajaxpro functions)
response(msg.d);
}
});
Run Code Online (Sandbox Code Playgroud)
输出将像这样(在firebug中显示为plain/text),如何将此数组附加到source属性.(我不能使用$ .ajax方法,因为我需要使用ajaxpro作为office规则),所以我从ajax调用中获取数组列表,如何绑定自动完成.
["List 1","List 2","List 3","List 4"];/*//这是来自jquery的输出响应(来自firebug)
[AjaxPro.AjaxMethod(HttpSessionStateRequirement.ReadWrite)]
public List<string> AutoComplete(string query)
{
List<string> objLisItmes = new List<string>();
objLisItmes.Add("List 1");
objLisItmes.Add("List 2");
objLisItmes.Add("List 3");
objLisItmes.Add("List 4");
return objLisItmes;
}
Run Code Online (Sandbox Code Playgroud)
这是Response头的firebug输出
Cache-Controlno-cache Content-Length40 Content-Typetext/plain; charset = utf-8 DateWed,2012年3月7日10:45:37 GMT Expires-1Pragmano-cache
本地我的应用程序使用ajaxpro工作正常,但在服务器上我似乎无法弄清楚它为什么不起作用.
使用firebug我有以下错误:
GET prototype.ashx 404未找到GET core.ashx 404未找到GET ms.ashx 404未找到
相同的代码在本地工作,所以它必须是IIS7设置?
编辑,我的web.config
<httpHandlers>
<add verb="POST,GET" path="ajaxpro/*.ashx" type="AjaxPro.AjaxHandlerFactory, AjaxPro"/>
</httpHandlers>
Run Code Online (Sandbox Code Playgroud)
也有:
<location path="ajaxpro">
<system.web>
<httpHandlers>
<add verb="POST,GET" path="*.ashx" type="AjaxPro.AjaxHandlerFactory, AjaxPro"/>
</httpHandlers>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
Run Code Online (Sandbox Code Playgroud)
和:
<location path="ajaxpro/prototype.ashx">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<location path="ajaxpro/core.ashx">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<location path="ajaxpro/converter.ashx">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
Run Code Online (Sandbox Code Playgroud) 我在我的项目中使用AjaxPro和AjaxControlToolkit.我的项目通常在带有IIS 6的Server 2003上运行.但是当我在Server 2008上加载我的项目时,我收到"AjaxPro undefined"错误.我的项目正在运行.Net Framework 4.0经典模式.
我试过了,但我的项目还没有工作.
在PlayStation 3、4,Xbox360,Xbox One上已重现此问题。所有版本的AjaxPro都存在此问题。
发出Ajax请求(使用AjaxPro)时,服务器返回正确的内容。但是,回调函数中返回的对象是
{
"error":
{
"Message":"","Type":"ConnectFailure","Status":200},"value":null,
"request":
{
"method":"MethodName",
"args":
{
"Argument1":"1111","Argument2":"2222"
}
},
"context":null,"duration":18
}
}
Run Code Online (Sandbox Code Playgroud)