簡體   English   中英

在 AJAX 調用 PHP function 后禁用 AJAX/Javascript 彈出窗口

[英]Disable AJAX/Javascript popup after AJAX invokes PHP function

Ok so im using AJAX to invoke a php function everything works perfectly except that when the function is completed an empty popup window appears at the top of my page saying "xyz.com says" with an empty box and ok button. 我只希望它在沒有彈出窗口和 append 一個字符串到<P>標記的情況下完成。

截屏

這是我的 Javascript:

function buildFunction() {
            document.getElementById("package").innerHTML = "Initializing Powershell...</br>";
            document.getElementById("package").innerHTML += "Building...<br><br>";

            $.ajax({
                    type: 'POST',
                    url: 'build.php',
                    success: function(data) {
                        document.getElementById("package").innerHTML += "Build Complete!";

                    }
                });
        }

build.php

function buildPackage()
{
    $serverName = "\\\\server";
    $msiName = '"""""""""MSI"""""""""';
    $installDir = '"""""""""D:\\APP"""""""""';

    $runCMD2 = "start powershell.exe psexec -accepteula -windowstyle hidden -s -i 2 " . $serverName . " cmd /c D:\app.hta " . $msiName . " " . $installDir;

    $execCMD = shell_exec("$runCMD2");
    //Begin Building
    echo $execCMD;
}

echo buildPackage();

所以我最終做/弄清楚的是我的 php 中的echo語句正在創建彈出窗口! 更改echo => return停止了彈出窗口。

function buildPackage()
{
    $serverName = "\\\\server";
    $msiName = '"""""""""MSI"""""""""';
    $installDir = '"""""""""D:\\APP"""""""""';

    $runCMD2 = "start powershell.exe psexec -accepteula -windowstyle hidden -s -i 2 " . $serverName . " cmd /c D:\app.hta " . $msiName . " " . $installDir;

    $execCMD = shell_exec("$runCMD2");
    //Begin Building
    return $execCMD;
}

return buildPackage();

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM