Reputation: 1795
The below mentioned code not redering the page. is there anything need to be added with this.
[HttpPost]
public ActionResult CompetitiveSnapshotDetails(Object[] comp)
{
CompetitiveSnapModel[] compSnapList = new JavaScriptSerializer().Deserialize<CompetitiveSnapModel[]>(comp[0].ToString());
String[] competitiveDetailHeader = { "State", "Rank", "Terracon Inc Transcations", "Number 1 Firm", "Number 2 Firm", "Number 3 Firm", "Total Transcations" };
ViewData["CompetitiveDetailHeader"] = competitiveDetailHeader;
ViewData["CompetitiveDetail"] = compSnapList;
return View();
}
Call this using ajax
$("#com-snap").click(function () {
var competitiveSnap = JSON.parse(window.localStorage.getItem("l_compSnap"));
var URL = "../Detailpage/CtDetails";
$.ajax({
cache: false,
type: "POST",
url: URL,
data: { comp: JSON.stringify(competitiveSnap)},
dataType: "json",
success: function (data) {
},
error: function (xhr) {
}
});
});
Upvotes: 0
Views: 39
Reputation: 14133
What I see is that in you AJAX code, you are not calling the same action you showed first. The URL you need to put is more like:
"/YourController/CompetitiveSnapshotDetails"
The second and more important issue is that your need to grab the html of your view and do something with it.
Your VIEW HTML is in your data
parameter in your success
function.
Something like this: $('#YourContainer').html(data);
Upvotes: 1