I faced an extremely sad issue with JSON parameters and honestly don't know how to resolve it.
I have an ASP.NET MVC 3 application, with JQuery on client side. On MVC side I have the following code:
[HttpPost]
public void SearchAsync(ServerRequest request)
{
....
}
public JsonResult SearchCompleted()
{
....
}
On client side, in turn, I have the following code:
function doSearch() {
var page = 1;
var startDate = $("#startdate-picker").val();
var endDate = $("#enddate-picker").val();
var sortingColumn = "Id";
var type = $("#ordertype-selector").val();
var user = $("#user-selector").val();
var request = { Page: page, StartDate: startDate, EndDate: endDate, SortAspect: sortingColumn, OrderType: type, User: user };
var requestToPost = JSON.stringify(request);
$("#info-message").show();
$("#content-table-body").hide();
$("#page-bar").hide();
$.post("/Common/Search",
requestToPost,
function (data) {
if (data.Collection) {
$("#info-message").hide();
...
}, 500);
}
}, "json");
};
I have a breakpoint on SearchAsync method and when the executing is bumping on it, there is data on request. ServerRequest is marked as [Serializable] and JsonValueProviderFactory is attached to the factories collection.
Does anyone know how can I solve this issue?
public void SearchAsyncwon't return any JSON back to your page, right?$.postcorrect? i think it should be/common/SearchCompletedSearchCompleted()doesnot expect any value ?