@{
ViewBag.Title = " Showing Data Using jQuery";
}
<div id="test">
</div>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var data = '@TempData["test"]';
alert(data);
$('#test').html('<h2>'+data+'</h2>');
});
</script>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
namespace techTest3.Controllers
{
public class HomeController : Controller
public ActionResult Index()
TempData["test"]="MyName";
return View();