簡體   English   中英

單擊“確定”時從數據庫獲取值的jquery警報框

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

當模糊功能提供警報消息時,我從數據庫獲取電子郵件字段的值。 在該警報消息中,如果我單擊“確定”,則它將獲取配置文件並顯示在我的視圖中。

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>

我找到了結果。只需在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>

如果使用確認框,則是可能的。 它是示例代碼。

        <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