本文介绍了使用jQuery传递给conroller方法的参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在开发MVC应用程序.我在控制器中有如下方法:

Hi,
I am working on MVC application.I have a method in controller as below:

public ActionResult LogOn(string viewAction)
        {
            if (string.IsNullOrEmpty(viewAction))
                return View();
            else
                return null;
        }



基于viewAction,我想执行一些操作,但是此viewAction从未初始化.我正在使用jQuery ajax传递参数,如下所示:



Based on the viewAction i want to perform some action but this viewAction never gets initialised.I am using jquery ajax to pass parameters as below:

function Navigate(action) {
    
    $.ajax({ url: customerIdURL, data: { viewAction: "action"} });
} 


但是问题是viewAction始终为null.请帮助我.


But the problem is that viewAction is always null..Please help me out.

推荐答案


但是问题是viewAction始终为null.请帮助我.


But the problem is that viewAction is always null..Please help me out.




这篇关于使用jQuery传递给conroller方法的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 22:09