如何显示弹出消息? [英] how to show popup message?

查看:85
本文介绍了如何显示弹出消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ajax方法,我想在成功完成时显示弹出消息.如果成功调用另一个ajax方法,则不会显示该消息.有人有任何想法如何显示弹出窗口吗?

I have an ajax method that I want to show a popup message on successful completion. If we call another ajax method on success, the message is not shown. Does anybody have any ideas how to show the popup?

function OnResetClick() {
      var userEmail = document.getElementById("ContentPlaceHolder1_User");
      var val = user.value;
      var r = "";
      var getPassword = {
          type: "POST",
          url: "main.aspx/GetString",
          data: "",
          contentType: "application/json; charset=utf-8",
          dataType: "json",
          success: function (response) {
            r = response.d;
            
            GetMsg(val, r);
          },
          error: function (result) {
            alert("Error in seding mail");
          }
        };
        //Call the PageMethods
        $.ajax(getPassword);
      }

function GetMsg(val, r) {
      if (randomPassword != "") {
        var options = {
          type: "POST",
          url: "main.aspx/GeMessage",
          data: "{'toMailAddress':'" + val + "','r':'" + r + "'}",
          contentType: "application/json; charset=utf-8",
          dataType: "json",
          success: function (response) {
            var val1 = response.d;
            // some times it shows, but mostly this alart 
            // message does not comes
            alert(val1);
          },
          error: function (result) {
            alert("Error in " + result);
          }
        };
        //Call the PageMethods
        $.ajax(options);
      }
    }

推荐答案

.ajax(getPassword); } 函数 GetMsg(val,r){ 如果(randomPassword!= " ) { var 选项= { 类型:" , 网址:" , 数据:" + val + " + r + " '}", contentType:" , dataType:" , 成功:功能(响应){ var val1 = response.d; // 有时会显示,但主要是 // 消息不出现 alert(val1); }, 错误:功能(结果){ alert(" +结果中的错误); } }; // 调用PageMethods
.ajax(getPassword); } function GetMsg(val, r) { if (randomPassword != "") { var options = { type: "POST", url: "main.aspx/GeMessage", data: "{'toMailAddress':'" + val + "','r':'" + r + "'}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (response) { var val1 = response.d; // some times it shows, but mostly this alart // message does not comes alert(val1); }, error: function (result) { alert("Error in " + result); } }; //Call the PageMethods


.ajax(options); } }
.ajax(options); } }




您可以使用此jquery插件
http://yensdesign.com/2008/09 /how-to-create-a-stunning-and-smooth-popup-using-jquery/ [ http://choosedaily.com/1178/15-jquery-popup-modal-dialog -plugins-tutorials/ [ ^ ]

对于我上面提到的第一个,您需要调用loadPopup();.执行某些任务后,可以从服务器端代码获取此功能,并且您还可以在更新面板中使用此功能,只需执行此操作,如果您使用的是脚本管理器,则可以使用此功能
ScriptManager.RegisterClientScriptBlock(this,this.GetType(),"_SHOW_POPUP","loadPopup();",true);
或者您可以在不使用脚本管理器的情况下使用此功能,
ClientScript.RegisterClientScriptBlock(this,this.GetType(),"_SHOW_POPUP","loadPopup();",true);

希望这会有所帮助.

谢谢,
如果发现正确,则将其标记为答案".
Hi,

You can use this jquery plugin
http://yensdesign.com/2008/09/how-to-create-a-stunning-and-smooth-popup-using-jquery/[^]
Or you can choose from any of these below
http://choosedaily.com/1178/15-jquery-popup-modal-dialog-plugins-tutorials/[^]

For the first one I mentioned above, You need to call loadPopup(); this function from server side code after some task is performed and you can use this with update panel also, all you need to do this, if you are using script manager then use this
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "_SHOW_POPUP", "loadPopup();", true);
Or you can use this in case you are not using script manager,
ClientScript.RegisterClientScriptBlock(this, this.GetType(), "_SHOW_POPUP", "loadPopup();", true);

Hope this is will help.

Thanks,
Mark it as Answer if you find it Correct.


这篇关于如何显示弹出消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆