我已經填充了對象SearchHomeModel並希望通過ajax請求將此對象傳遞給控制器。我的控制器的原型如下:通過ajax請求將對象傳遞給控制器
public ActionResult DataTableUserList(SearchHomeModel search, int iDisplayStart, int iDisplayLength, string sEcho)
,我Concat的它的URL字符串:
url = "/User/DataTableUserList?SearchHomeModel.FirstName=" + Model.SearchKeys.FirstName +
"&SearchHomeModel.LastName=" + Model.SearchKeys.LastName +
"&SearchHomeModel.Title=" + Model.SearchKeys.Title +
"&SearchHomeModel.Company=" + Model.SearchKeys.Company;
(然後通過這個鏈接直接調用Ajax)
,當我在調試器中調用DataTableUserList看我看到iDisplayStart有價值,但搜索爲空。如何在我的情況下通過這個對象?謝謝
看一看這個[鏈接] [1] [1]:HTTP: //stackoverflow.com/questions/5980389/proper-way-to-use-ajax-post-in-jquery-to-pass-model-from-strongly-typed-mvc3-vie – Anwar 2012-01-14 17:38:51
也在這裏http:// stackoverflow。 com/questions/4120212/mvc-ajax-json-post-to-controller-action-method – 2012-01-14 17:49:43