javascript - 无法使用 ajax 功能显示选项卡
问题描述
如何编写和调用函数来显示/隐藏 ajax 标记之外的 div?使用 OnClick 事件处理程序(我显示了一条警报消息,但该功能不起作用)
if ((data[i + 1].deviceName == data[i].deviceName) && (data[i + 1].protocol == data[i].protocol)) {
divbody += "<tr style=\"border-bottom:solid; border-width:thin\">";
divbody += "<th><input type=\"radio\" name=\"device\" onclick=\"alert('Hi_2')\" value=\"" + counter++ + "\"></th>";
divbody += picurl;
divbody += "<th style=\"padding:10px\">" + data[i].deviceName + "(" + data[i].protocol + ")" + "</th>";
divbody += "<th>" + data[i].display_Name + " : " + data[i].value + data[i].unit + " & " + data[i + 1].display_Name + " : " + data[i + 1].value + data[i + 1].unit + "</th > ";
divbody += "<th>" + data[i].timeStamp + "</th>";
divbody += "<th><img src=\"../wwwroot/images/Battery.png\" style=\"width:150px; height: 150px;\" /></th>";
divbody += "</tr>";
i++;
名为“设备”的单选按钮
<script>
$(document).ready(function () {
$("input[name$='device']").checked(function () {
$.ajax({
url: "#myTabs", success: function (result) {
$("#tbl-productos").html(result);
}
});
});
});
</script>
功能尝试
解决方案
推荐阅读
- wordpress - 致命错误 - 解析错误:语法错误,意外':',期待 - Wordpress
- javascript - 如何测试连接到 RabbitMQ 的 Promise?
- ios - iOS + Xcode + Swift 4.2 从 iOS 设备向 APNs 发送消息
- node.js - 上传 PDF 文件到 Express 服务器
- java - 素数分解解密
- sap - 如何提取特定年份的 sap 数据
- java - Spring Boot上的基本控制器给出404
- c# - 如何计算二维数组中唯一组合的总和
- web3 - 禁用 Metamask 时 Web3js 发送事务不会失败
- java - Firease 实时数据库无法注册新用户