I have a modal form that opens up for user to reset their password.
<div id="password-form" title="Reset Password">
<form method="post">
<fieldset>
<label for="emailreset">Enter Email Address</label>
<input type="text" name="emailreset" id="emailreset" class="text ui-widget-content ui-corner-all" />
</fieldset>
</form>
</div>
When the user hits the reset password button I call a function that checks if the user exists. upon success of the post I change the content of the div to a message generated. all of that works as expected. Now what I want to happen is once the close the modal dialog, I want the content to reset back to the form. I'm having problems making this happen.
Here is what I have for the jquery
$( "#password-form" ).dialog({
autoOpen: false,
height: 200,
width: 300,
modal: true,
buttons: {
"Reset Password": function() {
$.ajax({
url: "/model/websitemanager.cfc"
, type: "post"
, dataType: "html"
, data: {
method: "resetpassword"
, emailreset: $("#emailreset").val()
}
, success: function (data){
//alert(data);
$('#password-form').html('<p>'+data+'</p>');
}
// this runs if an error
, error: function (xhr, textStatus, errorThrown){
// show error
alert(errorThrown);
}
});
<!--//end ajax call//-->
},
},
close: function() {
emailreset.val( "" ).removeClass( "ui-state-error" );
$(this).dialog('destroy').remove()
}
});