jquery - popup windows doesn't open again when closed -


i've used popup window website.the popup window change password.. when fill data change password, works perfectly... given link popup as:

<div id="abc"></div> <div>     <a href="#" class="passwordlink" data-id=" model.profileview.password">change password</a> </div> 

the moment close popup using close button on right top [x], without filling data (suppose when mistakenly opened), , try once again open it, nothing happens..the popup stops working.. hash[#] appended in url when happens, when manually remove every time, popup works, else doesn't.. idea how should go about, if remove # href, instead of removing url, popup lasts few seconds , closes itself...

my complete code: change password

<script src="~/scripts/app-password.js/passwordupdate.js"></script>  

in script folder: 1)to open popup-containing partial view(called passwordupdate) change password..this view has fields change password,close button on right top[x] , save button..

$("#abc").dialog({ autoopen: false, modal: true, width: 450, title: "password updation" });  $(".passwordlink").click(function () { var id = $(this).attr("data-id"); $.ajax({     // call createpartialview action method     url: "/channel/passwordupdate",     type: 'get',     data: { password: id },     success: function (data) {         $("#abc").dialog("open");         $("#abc").append(data);      },     error: function () {         alert("something seems wrong");     } }); }); 

my partialview in popup: @model studimodel.studipasswordupdation

@using (html.beginform()) { @html.antiforgerytoken() <div style="text-align: center">     <div class="form-horizontal">         <h4>password updation</h4>         <hr />         @html.validationsummary(true)          <div class="form-group">             current password             <div id="currentpassword">                 @html.passwordfor(model => model.currentpassword)                 @html.validationmessagefor(model => model.currentpassword)             </div>         </div>          <div class="form-group">             new password             <div id="newpassword">                 @html.passwordfor(model => model.newpassword)                 @html.validationmessagefor(model => model.newpassword)             </div>         </div>          <div class="form-group">             confirm new password             <div id="confirmnewpassword">                 @html.passwordfor(model => model.confirmnewpassword)                 @html.validationmessagefor(model => model.confirmnewpassword)             </div>         </div>          <div id="submit-button"></div>         <div class="form"><div class="link_right"><button type="submit" class="orange" value="save">save</button></div></div>                </div> </div>   <div class="footer"></div> <link rel="stylesheet" href="~/css/accodation-styles.css"> <link rel="stylesheet" href="~/css/datepicker.css"> <link href="~/css/bootstrap.min.css" rel="stylesheet" type="text/css"> <script src="~/scripts/jquery-1.10.2.min.js"></script> <script src="~/scripts/jquery.validate.min.js"></script> <script src="~/scripts/jquery.validate.unobtrusive.min.js"></script> <script src="~/js/bootstrap.min.js" type="text/javascript"></script> <script src="~/js/accodation-script.js"></script> <script src="@url.content("~/scripts/jquery.unobtrusive-ajax.js")" type="text/javascript">      </script> <script type="text/javascript" src="~/js/bootstrap-datepicker.js"></script> <script src="~/scripts/app-password.js/passwordpartial.js"></script>    } 

on click of save button in passwordupdate partial view in popup, update of password happens.. $("#submit-button").click(function () { // on submit button click close dialog box $("#abc").dialog("close");

//set inserted vlaues var currentpassword = $("#currentpassword").val(); var newpassword = $("#newassword").val(); var confirmnewpassword = $("#confirmnewpassword").val();  // call create action method $.post('~/channel/passwordupdate', { "currentpassword": currentpassword, "newpassword":  newpassword, "confirmnewpassword": confirmnewpassword },     function (data) {         alert("data posted successfully");         window.location.reload(true);      }); }); 

so far good..the problem close button,open popup , close without entering values using close button[x], link "change password" stops working unless page loaded again...

just use href="" instead of href="#" should it.

btw.: why u use <a>-tag?


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -