在MVC中从Controller调用Javascript [英] Calling Javascript from Controller in MVC

查看:66
本文介绍了在MVC中从Controller调用Javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在用户界面中:



1)我必须检查组合框

2)作为HTTPGET,发送选定的ComboBox值

3)然后在执行控制器操作方法后取消选中ComboBox。



代码:

In UI:

1) I have to check the ComboBox
2) As HTTPGET, send the selected value of ComboBox
3) Then Uncheck the ComboBox, after execution of Controller Action Method.

Code:

$("#Search").click(function () {
        $(".selsts").attr('checked', false);
    });



这是我的JQuery取消选中按钮上的ComboBox单击搜索。



问题:



在将值发送给控制器Action之前,复选框得到Unchecked,因此我没有收到CheckBox值。



任何Suggessions /帮助?

推荐答案

#Search)。click( function (){
("#Search").click(function () {


。selsts)。attr(' checked' false );
});
(".selsts").attr('checked', false); });



这是我的JQuery取消选中按钮上的ComboBox单击搜索。



问题:



在将值发送到控制器操作之前,复选框将取消选中,因此我没有收到CheckBox值。



任何Suggessions /帮助?


我是猜测你正在使用jQuery AJAX,基于问题上的jQuery标签。在这种情况下,您需要在其中一个回调函数中更改checked属性,以确保在AJAX完成后触发它。您应该使用 success 完成回调函数,具体取决于您的需求。

I'm guessing you are using jQuery AJAX, based on the jQuery tag on the question. In that case, you need to change your "checked" attribute in one of the callback functions to ensure that it fires after the AJAX is complete. You should use the success or complete callback function, depending on what you want.


这篇关于在MVC中从Controller调用Javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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