我正在使用Jquery UI多值自动完成,我正在向服务器发出请求:
.autocomplete({
source: function(request, response) {
$.getJSON("handlers/autocomplete.ashx", {
term: extractLast(request.term)
}, response);
},
如何在我的.ashx处理程序中取回term
的值?
我已尝试过Request.Form["TextBox1"]
,但我收到object reference not set to an intance of an object
错误。有什么方法可以直接得到它吗?
谢谢
答案 0 :(得分:2)
使用url传递TextBox1值
.autocomplete({
source: function(request, response) {
$.getJSON("handlers/autocomplete.ashx?TextBox1=curtxt", {
term: extractLast(request.term)
}, response);
},
从Handlers中读取TextBox1 public void ProcessRequest(HttpContext context) {
HttpRequest request = context.Request;
HttpResponse response = context.Response;
string txtval = request["TextBox1"];
}