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
shosho s
NA
137
98.7k
How to return multiple values using json?
Feb 23 2016 7:15 AM
This is my script:
function UpdateFields() {
var StudentId = parseInt($('#@Html.IdFor(m => m.StudentId)').val());
var ProjectId= parseInt($('#@Html.IdFor(m => m.ProjectId)').val());
var Par = {
'StudentId ': StudentId ,
'ProjectId': ProjectId
};
$.ajax({
url: '@Url.Action("New")',
data: Par,
type: 'GET',
success: function (data) {
$('#@Html.IdFor(m => m.StudentId )').val(data);
$('#@Html.IdFor(m => m.ProjectId)').val(data);
},
error: function (request, status, error) {alert('error');
});
This is my action in my controller
public ActionResult New(StudentNewViewModel model)
{
model.LoadFromFields(SCPProvider, model.StudentId , model.ProjectId);
return Json(
model.StudentId ,
JsonRequestBehavior.AllowGet);
}
My question is how can i return both
StudentId and ProjectId
with Json? so that these two fields can be updated dynamically when changes on form are made.
Reply
Answers (
3
)
Working with word Document for mail merge
how to create simple mvc CRUD in asp.net using json