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...