Search Results

Search found 1 results on 1 pages for 'j3ko'.

Page 1/1 | 1 

  • ASP.NET MVC submitting json array to controller as regular post request (nonajax)

    - by j3ko
    All the examples of json I can find online only show how to submit json arrays w/ the jquery command $.ajax(). I'm submitting some data from a custom user control as a json array. I was wondering if it's possible to submit a json array as a regular post request to the server (like a normal form) so the browser renders the page returned. Controller: [JsonFilter(Param = "record", JsonDataType = typeof(TitleViewModel))] public ActionResult SaveTitle(TitleViewModel record) { // save the title. return RedirectToAction("Index", new { titleId = tid }); } Javascript: function SaveTitle() { var titledata = GetData(); $.ajax({ url: "/Listing/SaveTitle", type: "POST", data: titledata, contentType: "application/json; charset=utf-8", }); } Which is called from a save button. Everything works fine but the browser stays on the page after submitting. I was thinking of returning some kind of custom xml from the server and do javascript redirect but it seems like a very hacky way of doing things. Any help would be greatly appreciated.

    Read the article

1