使用ajax在MVC中回发问题 [英] Postback problem in MVC using ajax

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

问题描述

嗨专家

我是MVC的新手我想在后台进行回发但它会发布所有页面。 (不需要的显示页面进度条)



Hi experts
I'm new in MVC I want to do my postback in background but It posts all the page. (An unwanted showing page progress bar)

@using (Ajax.BeginForm("Index", "ContactUs", new AjaxOptions { HttpMethod = "POST" }, new { id = "contactUsForm" }))
{
   @Html.TextBoxFor(@m => m.Name, new { id = "name"})
   <input type="submit" value="Send"  />
}





当我点击提交它会发布所有页面,并且浏览器的进度条也会出现不合需要的情况!

但是:

我想在后台发帖。

我还能做些什么来实现我的目标?


谢谢



When I click on submit It posts all the page and also the browser's progress bar appears undesirably!
but:
I want to post in background.
What else may I do to achieve my goal?

Thanks

推荐答案

如果您希望在浏览器页面上显示进度,那么您可以使用ajax调用并离开操作和控制器空白。

If you want to have the progress to be shown on the Browser's page, then you can use ajax call and leave the Action and controller blank.


#SUBMIT BUTTON ID)。click(function(){
("#SUBMIT BUTTON ID").click(function(){


#YOUR PROGRESS DIV ID)。show();
("#YOUR PROGRESS DIV ID").show();


这篇关于使用ajax在MVC中回发问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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