Hi jon,
Check this example. Now please take its reference and correct your code.
Controller
public class HomeController : Controller
{
// GET: /Home/
public ActionResult Index()
{
string text = System.IO.File.ReadAllText("D:\\DeserializeResult.txt");
TempData["Notify"] = text.ToLower() == "processing" ? "data are refreshing" : "";
return View();
}
}
View
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Index</title>
</head>
<body>
<div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<% if (!string.IsNullOrEmpty(TempData["Notify"].ToString()))
{%>
<script type="text/javascript">
$(function () {
alert('<%: TempData["Notify"]%>');
});
</script>
<% }%>
</div>
</body>
</html>
Screenshot