我想在glgroupcode文本框中输入文本之后不久执行一个动作元数据,并且该方法接受输入参数 [英] i want to execute a action metnod soon after enetring a text in glgroupcode textbox and the method takes the input parameter

查看:70
本文介绍了我想在glgroupcode文本框中输入文本之后不久执行一个动作元数据,并且该方法接受输入参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<script type="text/javascript">

    $('#GLGroupCode').on('change', function (event) {
        alert("s");
        $.ajax({ url: "/GLMaster/TextChanged", type: "GET", data: { text: $('#GLGroupCode').val() }, dataType: 'json', success: function (result) {
            $('#txtSearch1').val(result);
        }
        });
    });

</script>






@ Html.TextBoxFor(model => model。 GLGroupName,new {id =txtSearch1})

@ Html.ValidationMessageFor(model => model.GLGroupName)


@Html.TextBoxFor(model => model.GLGroupName, new { id = "txtSearch1" })
@Html.ValidationMessageFor(model => model.GLGroupName)






@ Html.LabelFor(model => model.GLSubGroupCode)


@Html.LabelFor(model => model.GLSubGroupCode)






@ Html.TextBoxFor(model => model.GLSubGroupCode,new {id =txtSearchgrp})

@ Html.ValidationMessageFor(model => model.GLSubGroupCode)


@Html.TextBoxFor(model => model.GLSubGroupCode, new { id = "txtSearchgrp" })
@Html.ValidationMessageFor(model => model.GLSubGroupCode)







public JsonResult TextChangedTextChanged(string term)
       {


              var subGroups =  from p in  db.tblGLGroups where p.GroupCode== term  select p.GroupName;

           return Json(subGroups, JsonRequestBehavior.AllowGet);
       }

推荐答案

('#GLGroupCode')。on('change',function(event){
alert(s);
('#GLGroupCode').on('change', function (event) { alert("s");


.ajax({url:/ GLMaster / TextChanged,输入:GET,数据:{text:
.ajax({ url: "/GLMaster/TextChanged", type: "GET", data: { text:


('#GLGroupCode')。val()},dataType:'json',success:function(result){
('#GLGroupCode').val() }, dataType: 'json', success: function (result) {


这篇关于我想在glgroupcode文本框中输入文本之后不久执行一个动作元数据,并且该方法接受输入参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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