【发布时间】:2016-08-29 10:55:02
【问题描述】:
我有一个arduino webserver 服务器和一个normal webserver
此服务器之间的通信正在使用链接系统,例如:
普通网络服务器到 Arduino 服务器:
- ArduinoServer/light1=on - 灯亮
- ArduinoServer/light1=off - 灯关闭
Arduino 网络服务器到普通网络服务器:
- NormalWebserver/温度=22&湿度=56&light1=on
- NormalWebserver/温度=22&湿度=56&light1=关闭
通讯运行良好,但问题出在操作按钮上,当我切换灯光时,我需要 just to access 永恒的 arduino websever link 并且我还使用 ajax 来检查灯光声明。
如果更改了 light 语句,我的 div.id="light1" 将采用新的 javascript 内容,而我用于防止重定向到 arduino webserver 的旧代码不再起作用。
旧代码'acces only'按钮中的链接:
// Attach click handler to all 'access-only' links.
$('a.access-only').click(function() {
// Once the link is clicked, access its URL with a GET request.
$.get($(this).attr('href'), function(response) {
// Do nothing here, the URL has been accessed.
});
// Return false to prevent the browser's default click action.
return false;
});
但即使使用来自ajax 的新内容,我也需要一个代码来执行此操作。
【问题讨论】:
标签: javascript php jquery ajax