如何使用 ASP.NET 访问 jQuery AutoComplete extraParams

发布于 2024-09-14 09:09:11 字数 697 浏览 7 评论 0原文

我正在使用以下 jQuery 脚本发送“Make”参数来过滤我的“模型”:

$(document).ready(function () { $(".autocomplete_make").autocomplete("/AutoComplete/Make.ashx"); });
$(document).ready
    (function () {
        $(".autocomplete_model").autocomplete("/AutoComplete/Model.ashx"
                                                    , extraParams: {
                                                        make: function() {return $(".autocomplete_make").val(); }
                                                    }
                                                   );
    });

输入的文本作为“q”查询字符串传递到 .ashx 文件,但是,我不确定如何访问我的模型extraParam 'Make',这样我就可以将其传递给通用处理程序文件中的存储过程。我该怎么做?

谢谢, 柯特

I'm using the following jQuery script to send a 'Make' parameter to filter my 'Models':

$(document).ready(function () { $(".autocomplete_make").autocomplete("/AutoComplete/Make.ashx"); });
$(document).ready
    (function () {
        $(".autocomplete_model").autocomplete("/AutoComplete/Model.ashx"
                                                    , extraParams: {
                                                        make: function() {return $(".autocomplete_make").val(); }
                                                    }
                                                   );
    });

The text entered is passed to the .ashx file as a 'q' querystring, however, I'm not sure how I access my extraParam 'Make' so I can pass this to my stored procedure in the Generic Handler file. How do I do this?

Thanks,
Curt

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

抠脚大汉 2024-09-21 09:09:11

它应该像这样简单:

context.Request("make")

我相信您已经知道了。

我看到的唯一的另一个问题是你的 javascript 看起来有点缺陷,因为你没有传递一个对象作为第二个参数(选项)。

这是更正后的代码(我希望):

$(document).ready(function () {
  $(".autocomplete_model").autocomplete("/AutoComplete/Model.ashx", {
    extraParams: {
      make: function() {
        return $(".autocomplete_make").val(); 
      }
    } 
  });
});

It should be as simple as:

context.Request("make")

Which I believe you know already.

The only other problem I see is that your javascript looks a little flawed because you are not passing in an object as the second parameter (the options).

Here is the corrected code (I hope):

$(document).ready(function () {
  $(".autocomplete_model").autocomplete("/AutoComplete/Model.ashx", {
    extraParams: {
      make: function() {
        return $(".autocomplete_make").val(); 
      }
    } 
  });
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文