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
Issue - ajax refresh page after submit MVC.
Mani Kandan
7y
400
1
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...
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
Integrating Google Maps, Places, and Geocode APIs
Multi language support for ASP.NET MVC application