TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ashok kumar
NA
77
0
How to Read Tempdata, Viewbag to external JS file using ajax
Jun 26 2015 3:43 AM
How to Read Tempdata, Viewbag in external JS file using ajax jquery method
I have logon controller with method
public ActionResult Index()
{
TempData["Ex"] = "True";
return View();
}
i called a request by button's click event and click event code is in external js file as given
var data = $('form').serialize();
$.ajax({
url: "../RP/GetDetails",
// RP is another controller
dataType: 'html',
t ype: "GET",
data: data,
contentType: "application/html; charset=utf-8",
success: function (data)
{
if (
'@Html.Raw(TempData["Ex"])'
== 'True')
// Need to access tempdata value here
{
/ / Perform some action
}
else
{
// Else perform some other action
}
},
error: function (error)
{
alert("Please Check Model..!!");
}
});
In this case, Method of report controller is called on button click event but if session is expire then automatically login controller is called and tempdata
value is set based on that tempdata value in external js file, action will be prosessing but i am unable to get
TempData["Ex"]
js file.
Reply
Answers (
7
)
how to update one column value to another column with same
How to generate employee ID in c# asp.net