Controller: [HttpPost] public ActionResult View1(string SelectedVal) { IList<string> split1; split1 = SelectedVal.Split(new[] { '\n' }); ViewBag.Code = split1[0]; ViewBag.Desc = split1[2]; return View(); } JS: <script type="text/javascript"> function onClick(e) { //alert(e.item[0].outerText) var SelectedVal = e.item[0].outerText; //alert(SelectedVal) $.ajax({ url: "/TTSCancel/View1", data: JSON.stringify({ SelectedVal: SelectedVal }), dataType: "json", type: "POST", contentType: 'application/json; charset=utf-8' }); } </script> View: @model List<TTS.Models.CancelModel> <h3>Code :</h3> <label class="labelclass">@ViewBag.Code</label> <br /> <h3>Decsription :</h3> <label class="labelclass">@ViewBag.Desc</label> <br />
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)