jQuery AJAX works to return mvc 3 partial view but jQuery load doesn't

后端 未结 3 2206
挽巷
挽巷 2021-01-25 13:13

I\'m trying to populate a div with a partial view in MVC 3. My controller looks like this:

[HttpPost]
public ActionResult GetCustomerList(string searchString)
{         


        
3条回答
  •  情深已故
    2021-01-25 13:32

    I'm fairly certain your .load() call executes a GET request rather than a POST. MVC 3 and most other .NET AJAX transactions (methods decorated as a WebMethod, such as web services and page methods) require data to be POSTed. In this case you'll simply need to stick with what works. As you can see in your working $.ajax() call, the request method is a POST. If you want to short-hand some of the code, use .ajaxSetup() combined with .post().

提交回复
热议问题