【问题标题】:Change popup window into template alert Kendo将弹出窗口更改为模板警报剑道
【发布时间】:2019-07-22 06:52:23
【问题描述】:

在这里,我想将警报窗口更改为使用警报 Kendo UI 的模板。但是,我之前是使用 AJAX 来做警报的。

这里是警报窗口:

我需要帮助来用 AJAX 编写代码

AJAX PHP

//AJAX call for button
    $("#primaryTextButton").kendoButton();
    var button = $("#primaryTextButton").data("kendoButton");
    button.bind("click", function(e) {

    var test = $("#dropdown").val()

    $.ajax({
        url: "../DesignationProgramTemplate/getTemplate.php",
        type: "post",
            data: {'id':test,'progid':array},
                success: function () {
                // you will get response from your php page (what you echo or print)                 
                    alert('success'); //coding alert
                    //refresh
                    //location.reload("http://hq-global.winx.ehors.com:9280/ehors/HumanResource/EmployeeManagement/DesignationProgramTemplate/template.php");
                },
        /*  error: function(jqXHR, textStatus, errorThrown) {
            console.log(textStatus, errorThrown);
            }*/
        });
    });

对以上内容有何看法?

【问题讨论】:

    标签: javascript ajax kendo-ui alert


    【解决方案1】:

    你可以使用kendo.dialogs:

    //AJAX call for button
    $("#primaryTextButton").kendoButton();
    var button = $("#primaryTextButton").data("kendoButton");
    button.bind("click", function(e) {
    
      var test = $("#dropdown").val()
    
      $.ajax({
        url: "../DesignationProgramTemplate/getTemplate.php",
        type: "post",
        data: {
          'id': test,
          'progid': array
        },
        success: function() {
          // you will get response from your php page (what you echo or print)                 
          kendo.alert('success'); //coding alert
          //refresh
          //location.reload("http://hq-global.winx.ehors.com:9280/ehors/HumanResource/EmployeeManagement/DesignationProgramTemplate/template.php");
        },
        /*  error: function(jqXHR, textStatus, errorThrown) {
            console.log(textStatus, errorThrown);
            }*/
      });
    });
    

    示例:

    $("#alertBtn").on("click", function() {
      kendo.alert("This is a Kendo UI Alert message.");
    });
    
    $("#confirmBtn").on("click", function() {
      kendo.confirm("Are you sure that you want to proceed?").then(function() {
        kendo.alert("You chose the Ok action.");
      }, function() {
        kendo.alert("You chose to Cancel action.");
      });
    });
    
    $("#promptBtn").on("click", function() {
      kendo.prompt("Please, enter a arbitrary value:", "any value").then(function(data) {
        kendo.alert(kendo.format("The value that you entered is '{0}'", data));
      }, function() {
        kendo.alert("Cancel entering value.");
      })
    });
    html {
      font-size: 14px;
      font-family: Arial, Helvetica, sans-serif;
    }
    <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.2.619/styles/kendo.common.min.css" />
    <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.2.619/styles/kendo.uniform.min.css" />
    <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.2.619/styles/kendo.uniform.mobile.min.css" />
    
    <script src="https://kendo.cdn.telerik.com/2019.2.619/js/jquery.min.js"></script>
    <script src="https://kendo.cdn.telerik.com/2019.2.619/js/kendo.all.min.js"></script>
    <button id="alertBtn" class="k-button">kendo.alert</button>
    <button id="confirmBtn" class="k-button">kendo.confirm</button>
    <button id="promptBtn" class="k-button">kendo.prompt</button>

    【讨论】:

    • 我可以将它插入 AJAX 吗?
    • @HelpMe by 将其插入 AJAX 我认为您的意思是 AJAX?如果是,那么可以,您可以致电kendo.alert('Success')
    • 你能在我的代码中显示吗?我有点困惑,抱歉我是刚接触剑道的新手
    • 我正在使用按钮提交,以便在成功发送数据后,会出现我正在使用 AJAX 的通知警报成功。
    • 我已经编辑了答案,是你要找的吗?
    猜你喜欢
    • 1970-01-01
    • 2023-03-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多