$(document).ready(function(){ $("#forgot-password-dialog").dialog({ autoOpen: false, modal: true, width: 500, height: 200, resizable: false, title: "Reset Password", buttons: [ { text: "Cancel", click: function(){$(this).dialog("close");} }, { id: "forgot-password-continue", text: "Continue", click: function(){ $("#forgot-password-form").form("disable"); $.ajax({ type: "POST", url: "/reg_ajax.php?request=password_reset", data: {email: $("#forgot-password-email").val()}, dataType: "json", success: function(data) { $("#forgot-password-form").form("enable"); if(is_ajax_success(data)){ $("#forgot-password-form").html("

Thank you, an email has been sent with a link to reset your password.

"); $("#forgot-password-continue").remove(); } }, error: ajax_error_handler }); } } ] //end buttons }); //end #forgot-password-dialog $(document).on("click", "#forgotPassword", function(){ $("#forgot-password-email").empty(); $("#forgot-password-dialog").dialog("open"); return false; }); //Init our form jQuery on the div $("#forgot-password-form").form({}); });