简体   繁体   English

单击“确定”时从数据库获取值的jquery警报框

[英]jquery alert box when click “OK” get the values from database

i get the values from database for email field when blur function it gives alert message. 当模糊功能提供警报消息时,我从数据库获取电子邮件字段的值。 In that alert message if i click ok means it will get the profile and show in my view..Is it possible? 在该警报消息中,如果我单击“确定”,则它将获取配置文件并显示在我的视图中。

Jquery code: 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>

I found the result.. Just pass the url in ajax post like the following, 我找到了结果。只需在ajax帖子中传递如下网址,

<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>

It is possible if you use confirm box. 如果使用确认框,则是可能的。 It is the example code. 它是示例代码。

        <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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM