Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
1
Reply
Issue - ajax refresh page after submit MVC.
Mani Kandan
Mar 13 2017 9:22 PM
389
Reply
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...
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
Integrating Google Maps, Places, and Geocode APIs
Multi language support for ASP.NET MVC application