Here Mudassar Ahmed Khan has explained with an example, how to set TempData using JavaScript or jQuery in ASP.Net MVC Razor.
TempData is created on Server Side of the Web application and hence it is not possible to directly set it on Client Side using JavaScript or jQuery.
Thus, only possible way is to set it by making an AJAX call to the Controller’s Action method using jQuery AJAX function in ASP.Net MVC Razor.
↧