MVC 5 Control gets a simple parameter jquery ajax came

Original link: http://www.cnblogs.com/andrewhappy/p/5427009.html

The problems closed for several days, the solution is actually simple.

Problems: jQuery.ajax a single value of the parameter to be passed to the server of the Control action, such as id = 1, the parameter generally considered writing data: data: {id: 1} is obtained and the various action null.

Solution:

  1. Deletion of contentType parameter jQuery.ajax
  2. The data parameter parentheses: ({id: 1})

Get.

Not my own resolve, programs from the Almighty stockoverflow, links http://stackoverflow.com/questions/2558870/asp-net-mvc-jquery-ajax-input-parameters-are-null

Reproduced in: https: //www.cnblogs.com/andrewhappy/p/5427009.html

Guess you like

Origin blog.csdn.net/weixin_30411997/article/details/94785540