如何在1个ajax调用中调用2个actionresult方法。 [英] How to call 2 actionresult method in 1 ajax call.

查看:63
本文介绍了如何在1个ajax调用中调用2个actionresult方法。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi
如何在一次ajax调用中调用两个actionresult方法..?

Hi How to call two actionresult method in one ajax call..?
In

$('#st-btn')

按钮单击我正在调用show1ActionResult方法

同时我想再调用一个Actionresult方法(即) show2 同样的电话..

在我的第二个ActionResult中,我想检查是否检查了checkbutton?

如果选中,我想在我的成功中更新bool值..

任何建议会有帮助吗?



我尝试过的事情:



button click i'm calling "show1" ActionResult Method
Meanwhile i want to call one more Actionresult method (i.e) show2 in the same call..
In my second ActionResult i want to check whether checkbutton is checked are not?
If checked i want to update the bool value in my success..
Any suggestion would be helpful?

What I have tried:

<pre> $('#st-btn').on('click', function (e) {
                    e.preventDefault();
                    var _data = {
                        VModel: (@Html.Raw(Json.Encode(Model))),
                        IValue: $("#txt1").val(),
                        N: 'justin'

                    }
                    $.ajax({
                        type: 'POST',
                        dataType: "json",
                        contentType: 'application/json; charset=utf-8',
                        url: "@Url.Action("show1")",
                        async: false,
                        data: JSON.stringify(_data),
                        success: function (data) {}

推荐答案

('#st-btn')
('#st-btn')

按钮单击我正在调用show1ActionResult方法

同时我想再调用一次Actionresult方法(即) show2 打电话..

在我的第二个ActionResult中,我想检查是否检查了checkbutton?

如果选中,我想在我的成功中更新bool值..

任何建议都会有所帮助吗?



我尝试了什么:



button click i'm calling "show1" ActionResult Method
Meanwhile i want to call one more Actionresult method (i.e) show2 in the same call..
In my second ActionResult i want to check whether checkbutton is checked are not?
If checked i want to update the bool value in my success..
Any suggestion would be helpful?

What I have tried:

<pre>


('#st-btn')。on('click',function(e){
e.preventDefault();
var _data = {
VModel:(@ Html.Raw(Json.Encode(Model))),
IValue:
('#st-btn').on('click', function (e) { e.preventDefault(); var _data = { VModel: (@Html.Raw(Json.Encode(Model))), IValue:


(#txt1 ).val(),
N:'justin'

}
("#txt1").val(), N: 'justin' }


这篇关于如何在1个ajax调用中调用2个actionresult方法。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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