Me Hava A下拉列表和文本框现在我想要当下拉列表索引更改我访问该值 [英] Me Hava A Drop Down List And A Textbox Now Me Want When The Dropdown List Index Change I Access That Value

查看:69
本文介绍了Me Hava A下拉列表和文本框现在我想要当下拉列表索引更改我访问该值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码

当我更改index时给出相同的值。如果我再次更改索引它会给出相同的结果

我有以下代码< br $>

me have the following code
which give same value when i change the index.if i change the index again it give same resulte
me have the following code





<script  type="text/javascript">
            $(function () {  var index= $("select[id=ddlSerch] option:selected").val() $('#<%=txtSerch.ClientID%>').autocomplete({
                 source: function (request, response) {
                     $.ajax({
                         url: "HOME.aspx/GetCompanyName",
                         data: "{'pre':'" + request.term + "','index':'" + index + "'}",
                         dataType: "json",
                         type: "POST",
                         contentType: "application/json; charset=utf-8",
                         success: function (data) {
                             response($.map(data.d, function (item) {
                                 return { value: item }
                             }))
                         },
                         error: function (XMLHttpRequest, textStatus, errorThrown) {
                             alert(textStatus);
                         }
                     });
                 }
             });
         });
</script>

推荐答案

(function(){var index =
(function () { var index=


(select [id = ddlSerch] option:selected)。val()
("select[id=ddlSerch] option:selected").val()


('#<% = txtSerch.ClientID %> ')。autocomplete({
来源:功能(请求,响应){
('#<%=txtSerch.ClientID%>').autocomplete({ source: function (request, response) {


这篇关于Me Hava A下拉列表和文本框现在我想要当下拉列表索引更改我访问该值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆