简体   繁体   中英

HttpPost or HttpGet for JsonResult?

I am calling from jQuery $.ajax JsonResult actions from my controller.

I can either use get or post for JsonResult, but are there some good practices regarding this?

I and my colleagues use interchangeably these two, with no logic behind them.

for ActionResult, things is pretty clear: is it a page accessible from the browser? HttpGet. Is it some button on the page? HttpPost.

We use the various methods of Http such as

Get To Get the Resource Post To Add the Resource Patch To Modify Resource Delete To Delete Resource

Also if you want to get resource and you are supposed to send the sensitive data then it is always good that you pass that data in body instead of passing as an paramter in URL

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM