Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
1
Answer
i need to pass whole model from view to controler using ajax
erum mirza
7y
138
1
Reply
can any one help me how to pass model object from view to controller using ajax .i have below code but not working.i am getting null in
EmpAddType .even i selected any thing from drop downlist
<script>
function GetFilter() {
var employeeAddress = {
"EmpAddType"
: $(
"#drop1 option:selected"
).text()
}
alert($(
"#drop1 option:selected"
).text());
alert(employeeAddress.EmpAddType);
$.ajax({
url:
'@Url.Action("SaveAddress")'
,
type:
'POST'
,
cache:
false
,
contentType:
'application/json'
,
dataType:
"json"
,
data: JSON.stringify(employeeAddress),
success: function (data) {
alert(
"You Multiple Data Passed Successfully"
);
},
error: function () {
alert(
"failed"
);
}
});
}
function showDiv() {
$(
'#MailingContactDetails'
).show(1000)
}
function showDiv2() {
$(
'#AccountDetail'
).show(1000)
}
</script>
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
command injection prevention using c#
View engine in mvc required??