简体   繁体   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. 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. I just want it to complete with no popup and append one string to a <P> tag.我只希望它在没有弹出窗口和 append 一个字符串到<P>标记的情况下完成。

截屏

Here is my Javascript:这是我的 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 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();

So what I ended up doing/figuring out was that the echo statements in my php were creating the pop up!所以我最终做/弄清楚的是我的 php 中的echo语句正在创建弹出窗口! Changing echo => return stopped the pop up.更改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