简体   繁体   中英

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. I just want it to complete with no popup and append one string to a <P> tag.

截屏

Here is my 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();

So what I ended up doing/figuring out was that the echo statements in my php were creating the pop up! Changing echo => return stopped the pop up.

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();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM