Which one is better? Ajax post or page post[Controller httppost] when only one form is there in a page?

久未见 提交于 2019-12-06 08:02:33

Post Back

  1. Browser Handling - The only advantage I can think of is that the browser will handle redirects and progress loading for you. You don't need to write the logic to redirect users or show a loading bar.

AJAX

  1. Asynsconous - With AJAX you're getting asyncronous calls so the browsers thread isn't blocked. This allows the user to still interact with the UI whilst waiting for the response from your request.

  2. Better Performance -You generally don't need to reload the entire page resulting in less overhead & HTTP requests being made.

FYI - You can still model bind with JsonResult

public JsonResult BookProgram(Mymodel model)
{
       //code to save into db
       return Json(result);
}

Post back - is a classic workflow. Delegate most of inner work to your webbrowser. All your responce logic calculated on server side.

AJAX - is a modern way of building dynamic web-applications. Base approach for single-page-applications. Most of work in this case should be done on client side.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!