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
         )};
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置