English 中文(简体)
联系人:JQuery与ASP。 Net MVC
原标题:Losing context from JQuery post with ASP.Net MVC

我在一页上有一个叫作 like的JQuery dialog盒:

$.post("/MyController/MyAction", { myKey: key} //...

而这一成功举了:

[HttpPost]
public ActionResult MyAction(int myKey)
{
   //do some stuff
   return RedirectToAction("AnotherAction");       
}

问题是,“再行动”对网络浏览器没有影响。 我对此表示怀疑,因为“JQuery”员额是不同的read子,因此不知道何时发出答复? 我如何让浏览器装载新的对策?

最佳回答

是的,<代码>$.post正在做一个jax员额,《行动》不会改头。

如果你重开任何路,为什么不仅仅提交表格,就不需要ja。

或者,你可以填写<代码>$.get,并将JsonResult退回,用j Query/javascipt表示成功/失败和方向。

<>Update>

与此类似:

如果你可以据此确定科索沃或欧洲复兴开发银行,并添加任何物体作为“项目”,而“项目”可在观点或错误信息上加以利用,或改向等

[HttpPost] 
public JsonResult MyAction(int myKey) 
{ 
   //do some stuff 
   return new JsonResult { Data = new { Item = item, Result = "OK/ERR" } };
} 
问题回答

暂无回答




相关问题
WebForms and ASP.NET MVC co-existence

I am trying to make a WebForms project and ASP.NET MVC per this question. One of the things I ve done to make that happen is that I added a namespaces node to the WebForms web.config: <pages ...

Post back complex object from client side

I m using ASP.NET MVC and Entity Framework. I m going to pass a complex entity to the client side and allow the user to modify it, and post it back to the controller. But I don t know how to do that ...

Create an incremental placeholder in NHaml

What I want to reach is a way to add a script and style placeholder in my master. They will include my initial site.css and jquery.js files. Each haml page or partial can then add their own required ...

asp.net mvc automapper parsing

let s say we have something like this public class Person { public string Name {get; set;} public Country Country {get; set;} } public class PersonViewModel { public Person Person {get; ...

structureMap mocks stub help

I have an BLL that does validation on user input then inserts a parent(PorEO) and then inserts children(PorBoxEO). So there are two calls to the same InsertJCDC. One like this=>InsertJCDC(fakePor)...

ASP.NET MVC: How should it work with subversion?

So, I have an asp.net mvc app that is being worked on by multiple developers in differing capacities. This is our first time working on a mvc app and my first time working with .NET. Our app does not ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

热门标签