During AJAX call is it possible to return ViewData, TempData or a session back to the view? does these variables are included in the cycle? please comment
function submitForm(frm) {
var tdata = $(frm).serialize();
$.ajax({
url: "/Organization/EditOrganizationMeta",
data: tdata,
success: function (result) {
if (result["ErrorMessage"] == "No Error") {
$("#" + result["DivName"] + "1").hide();
$("#" + result["DivName"]).show();
$("#" + result["DivName"]).empty();
$("#" + result["name"]).attr("value", result["SavedValue"]);
$("#" + result["DivName"]).append("<b>" + result["SavedValue"] + "</b>");
$("#" + result["DivName"] + "2").empty();
$("#" + result["DivName"] + "2").append("<b>Record is successfully saved</b>");
}
else if (result["ErrorMessage"] != "") {
$("#" + result["DivName"] + "1").show();
$("#" + result["DivName"]).hide();
$("#" + result["DivName"]).empty();
$("#" + result["name"]).attr("value", result["PreviousValues"]);
$("#" + result["DivName"] + "2").empty();
$("#" + result["DivName"]).append("<b>" + result["PreviousValues"] + "</b>");
$("#" + result["DivName"] + "2").append("<b>" + result["ErrorMessage"] + "</b>");
}
},
type: "POST",
datatype: "json"
});
return false;
}