dtp19819 2016-07-18 14:53
浏览 39
已采纳

嗨,我正在使用PHP执行python脚本,但我不想在点击按钮时刷新页面,因为我也嵌入了其他页面[关闭]

This is the php and html code I am using motion to stream video in it

<html>

<head>

<meta charset="UTF-8" />
<link rel="stylesheet" type="text/css" href="css/style.css">

</head>

<?php

if (isset($_POST['LightBLINK']))
{
exec("sudo python /var/www/html/open.py");
}

?>

<form method="post">
<button class="btn" name="LightBLINK">Light BLINK</button><br><br></form> 

<body>

<h1>Raspberry Pi Webcameras</h1>
<a href="http://192.168.1.3:8081/">
<img src="http://192.168.1.3:8081/" alt="Camera 1" ></a>
<a href="http://192.168.1.3:8082/">
<img src="http://192.168.1.3:8082/" alt="Camera 2" ></a>

</body>

</html>

The problem is that when I click the "LIGH BLINK" button it executes the open.py script but along with it the complete web page refreshes which causes the embedded pages(video in my case) to refresh.

The thing i want is that when i click the "LIGHT BLINK" button it should execute the open.py script as before . but donot refresh the whole page so that my video feed remains undisturbed.

  • 写回答

1条回答 默认 最新

  • dongqishun6409 2016-07-18 15:02
    关注

    Use JQUERY Ajax

        $.post("url to process data",{data:data}, function(response){
           //do something with the response
         )};
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 需要跳转番茄畅听app的adb命令
  • ¥50 寻找一位有逆向游戏盾sdk 应用程序经验的技术
  • ¥15 请问有用MZmine处理 “Waters SYNAPT G2-Si QTOF质谱仪在MSE模式下采集的非靶向数据” 的分析教程吗
  • ¥50 opencv4nodejs 如何安装
  • ¥15 adb push异常 adb: error: 1409-byte write failed: Invalid argument
  • ¥15 nginx反向代理获取ip,java获取真实ip
  • ¥15 eda:门禁系统设计
  • ¥50 如何使用js去调用vscode-js-debugger的方法去调试网页
  • ¥15 376.1电表主站通信协议下发指令全被否认问题
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证