0

当模糊功能发出警报消息时,我从数据库中获取电子邮件字段的值。在该警报消息中,如果我单击“确定”意味着它将获取配置文件并显示在我的视图中..这可能吗?

jQuery代码:

<a id="checkEmail" href="#" ></a> | <a id="getCandidate"></a>

            <script type ="text/javascript">
                $('#getCandidate').text('Get Profile') // Sets text for email.
                    .attr('href', '#');

                $("#Email").blur(function () {
                    $('#checkEmail').trigger('click');
                    $('#getCandidate').text('Get Profile')
                    .attr('href', 'GetCandidateDetail?validateEmail=' + $('#Email').val());
                });


                $(document).ready(function () {
                    $('#checkEmail').click(function () {
                        var name = $('#Email').val();
                        var data = 'validateEmail=' + name;
                        $.ajax({
                            type: "GET",
                            url: "ValidateCandidate",
                            data: data,
                            success: function (data) {
                                alert(data);

                            }
                        });
                        return false;
                    });
                });
          </script>
4

2 回答 2

1

我找到了结果..只需在 ajax 帖子中传递 url,如下所示,

<script>

$(document).ready(function () {
                        $('#emailcheck').click(function () {

                            var name = $('#Email').val();
                            var data = 'getemail=' + name;
                        $.ajax({
                            type: "GET",
                            url: "geturl",
                            data: data,
                            success: function (data) {
                                window.location = "/home/homeurl/GetDetails?email=" + name;
                                alert(data);
                            }

                        });
                        return false;
                    });
                });
          </script>
于 2013-12-16T09:57:52.677 回答
0

如果您使用确认框,这是可能的。这是示例代码。

        <a id="checkEmail" href="#" ></a> | <a id="getCandidate"></a><script type ="text/javascript">
            $('#getCandidate').text('Get Profile') // Sets text for email.
                .attr('href', '#');

            $("#Email").blur(function () {
                $('#checkEmail').trigger('click');
                $('#getCandidate').text('Get Profile')
                .attr('href', 'GetCandidateDetail?validateEmail=' + $('#Email').val());
            });


            $(document).ready(function () {
                $('#checkEmail').click(function () {
                    var name = $('#Email').val();
                    var data = 'validateEmail=' + name;
                    $.ajax({
                        type: "GET",
                        url: "ValidateCandidate",
                        data: data,
                        success: function (data) {
                            if (confirm("Press a button!"))
                            {
                               //Do you changes 
                            }
                        }
                    });
                    return false;
                });
            });
      </script>
于 2013-09-19T11:17:20.690 回答