﻿$(document).ready(function() {
    $('.btnSendEmail').unbind().click(function() {
        var keyword = $.trim($('#txtKeyword').val());
        if (keyword.length == 0) {
            AlertTips("系统提示：", "请输入您的用户名或注册邮箱！", 1, "$('#txtKeyword')[0].focus()");
            return;
        }
        ShowLoading();
        $.ajax({
            type: "POST",
            url: userControllerUrl + '/PWDSendMailAjax/',
            data: { 'keyword': keyword, 'guid': guid },
            success: function(data) {
                HideLoading();
                if (data.indexOf('success') == -1) {
                    AlertTips("系统提示：", data, 2);
                    return;
                }
                var email = data.split('|')[1];
                $('#divSendEmail').hide();
                $('#linkSendEmail').html(email);
                $('#divSendEmailSuccess').show();
            },
            error: function(xmlHttpRequest, error) {
                HideLoading();
                AlertTips("系统提示：", "对不起，系统故障，我们将尽快处理！", 2);
            }
        });
    });
});
