我用树莓圆周率脉冲继电器(下表提交)到另一件设备,如果成功脉冲将切换继电器开/关。切换继电器返回到pi作为一个输入,该输入在状态.php加载分区内的页面。如果我加载下面的页面,它将正确显示状态.php,但在按下表单提交按钮后,它不会重新加载状态.php第页。我已经尽力了,请帮帮我!你知道吗
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Alarm Panel</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<script src="http://code.jquery.com/jquery-2.1.3.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<script type="text/javascript">// <![CDATA[
$(document).ready(function() {
$.ajaxSetup({ cache: false });
setInterval(function() {
$('#loading').load('/status.php');
}, 2000);
});
// ]]>
</script>
<?php
if (isset($_POST['PULSE'])) {
shell_exec('python /usr/lib/cgi-bin/pulse.py');
}
?>
</head>
<body>
<div id="currentstatus" data-role="collapsible" data-theme="b" data-content-theme="b" data-collapsed="false">
<h1>Current status</h1>
<div id="loading" align="center">
<H3>Loading Status...</H3>
</div>
</div>
<div data-role="collapsible" data-theme="b" data-content-theme="b">
<h4>Change Status</h4>
<form method="post">
<input type="submit" name="PULSE" value="PULSE" />
</form>
</div>
</body>
</html>
你知道吗状态.php
<?php
$status = shell_exec('python /usr/lib/cgi-bin/status.py');
?>
<h3><? echo $status; ?></h3>
<br />
<img src="/img/<? print $status; ?>.jpg" height="250"; width="250";>
你试过控制自己的行为吗?那也许能解决它。你知道吗
您也可以尝试更改超时函数。。。这有点棘手,因为load是一个异步函数。你知道吗
此外,您还意外地在img元素中添加了分号:
更改:
收件人:
相关问题 更多 >
编程相关推荐