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
Abhilash J A
533
2.4k
598.2k
Issue - ajax refresh page after submit MVC.
Mar 13 2017 9:22 PM
Hello everyone,
I am working on MVC 5, there is registration page look like,
@using (Html.BeginForm(null, null, FormMethod.Post, new {
id
=
"submitBasicUserReg"
}))
{
@Html.TextBoxFor(
model
=
>
model.listPartnerVM.LoginName, new { @
id
=
"idemail"
, @
class
=
"form-control input-sm "
, @
placeholder
=
"E-mail"
, @
maxlength
=
"50"
})
@Html.PasswordFor(
model
=
>
model.listPartnerVM.Password, new { @
id
=
"password"
, @
class
=
"form-control input-sm "
, @
placeholder
=
"Password"
, @
maxlength
=
"20"
})
@Html.PasswordFor(
model
=
>
model.listPartnerVM.ConfirmPassword, new { @
id
=
"password"
, @
class
=
"form-control input-sm "
, @
placeholder
=
"Confirm Password"
, @
maxlength
=
"20"
})
<
input
type
=
"submit"
value
=
"Submit"
class
=
"btn reg-btn btn-block"
>
}
Ajax,
$(
"#submitBasicUserReg"
).submit(
function
(e) {
var
formData =
new
FormData(
this
);
$.ajax({
url:
"/UserRegister/GetBasicUserReg"
,
type:
"POST"
,
data: $(
'form'
).serialize(),
success:
function
(result) {
$(
"#divSavedMessage"
).html(result);
},
error:
function
(result) {
}
});
e.preventDefault();
});
Controller,
[HttpPost]
public
ActionResult GetBasicUserReg(PartnersVM partnersVM)
{
PartnerBL partnerBL =
new
PartnerBL();
PartnerBIL partnerBIL =
new
PartnerBIL();
partnerBL.LoginName = partnersVM.listPartnerVM.LoginName;
partnerBL.Password = partnersVM.listPartnerVM.Password;
partnerBIL.Partner_AddUpdate(partnerBL);
return
View(
"_savedSuccessMessageBox"
);
}
The problem is, after saving data and redirect to the same registration page then, texboxes are carrying saved previous value. How can I refresh the page as new entry?
Please help me...
Reply
Answers (
1
)
Integrating Google Maps, Places, and Geocode APIs
Multi language support for ASP.NET MVC application