提取单选框的值,并通过ajax传值到后台

<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
  <th:block th:include="include :: header('日库存更新提示')" />
</head>
<style>
    .danxuankuang{
        margin-left: 20px;
    }
</style>
<body class="gray-bg">
<div class="container-div">

    <div class="danxuankuang">
        <input style="margin-top: 0.8em;" type="radio" id="option1" name="group1"  value="allOilTank">
        <label for="option1">a</label>
    </div>
    <div class="danxuankuang">
        <input style="margin-top: 0.8em;" class="tubiao" type="radio" id="option2" name="group1" value="oneOilTank">
        <label for="option2">b</label>
    </div>
    <div class="danxuankuang">
        <input style="margin-top: 0.8em;" class="tubiao" type="radio" id="option3" name="group1" value="twoOilTank">
        <label for="option3">c</label>
    </div>
    <div class="danxuankuang">
        <input style="margin-top: 0.8em;" class="tubiao" type="radio" id="option4" name="group1" value="threeOilTank">
        <label for="option3">d</label>
    </div>

</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
  function submitHandler() {
     update()
  }
    function update() {
    	//单选框的值
        var val=$('input:radio[name="group1"]:checked').val();
        // console.log(val)
        $.ajax({
            cache : true,
            type : "POST",
            url : ctx+'/ab/timePointInventory/'+val,
            data : val,
            async : false,
            error : function(request) {
                // console.log(request)
                $.modal.alertError("系统错误");
            },
            success : function(data) {
                // console.log(data)
                $.operate.successCallback(data);
            }
        });
    }
</script>
</body>
</html>

最近更新

  1. TCP协议是安全的吗?

    2024-04-01 22:22:02       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-04-01 22:22:02       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-04-01 22:22:02       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-04-01 22:22:02       20 阅读

热门阅读

  1. Spring 的 Ioc配置

    2024-04-01 22:22:02       13 阅读
  2. Python:文件读写

    2024-04-01 22:22:02       15 阅读
  3. NodeJs(前端面试题整合)

    2024-04-01 22:22:02       15 阅读
  4. 潍坊如何申请专利

    2024-04-01 22:22:02       14 阅读
  5. RTOS--异常向量和中断向量

    2024-04-01 22:22:02       15 阅读
  6. c++计算浮点数相除的余

    2024-04-01 22:22:02       16 阅读
  7. C++20中的jthread

    2024-04-01 22:22:02       11 阅读
  8. 密码攻击

    2024-04-01 22:22:02       11 阅读
  9. SpringBoot单元测试

    2024-04-01 22:22:02       16 阅读
  10. 日常有疑惑的点总结

    2024-04-01 22:22:02       13 阅读