ajax显示dataframe,如何使用ajax在运行时显示shell脚本的输出

我有两个php页面。第一页将加载到客户端浏览器和显示按钮。如果点击它将使用Ajax调用来执行我的第二个PHP页面。第二个php页面使用ssh2_exec连接到服务器,执行一些shell脚本并在不刷新的情况下在同一个加载的页面上显示输出。我可以用我现有的页面来实现这一点。但它在第二页完成执行后立即显示完整的输出。我希望作为第二个php页面开始执行,输出应该在客户端浏览器上逐行显示。如何使用ajax在运行时显示shell脚本的输出

下面是我的2页:

PHP第1页:

function disable()

{

document.getElementById("save").disabled = true;

}

function enable_button()

{

document.getElementById("save").disabled = false;

if (window.XMLHttpRequest) {

xmlhttp = new XMLHttpRequest();

}

else {

xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');

}

xmlhttp.onreadystatechange = function() {

if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {

document.getElementById('output').innerHTML = xmlhttp.responseText;

}

}

xmlhttp.open('GET', 'arg0_orgcmd_exec.php?id=118' , true);

xmlhttp.send();

}

function disable_button()

{

document.getElementById("execute").disabled = true;

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值