Bootstrap

jquery ajax post 请求表单格式x-www-form-urlencoded

<body>
    <form id="submitForm">
      <input type="hidden" id="userId" name="userId" value="283" />
      <input type="hidden" id="pageSize" name="pageSize" value="99" />
    </form>
    <div class="wrap">
        666        
    </div>
</body>
<script src="js/jquery-1.12.4.min.js"></script>
<script>
  const serialize = (formEle) => Array.from(new FormData(formEle)).reduce((p, [k, v]) => Object.assign({}, p, { [k]: p[k] ? (Array.isArray(p[k]) ? p[k] : [p[k]]).concat(v) : v }), {});
  const jsonData = serialize($("#submitForm").get(0));
  $.ajax({
    url: 'https://tool.keeko.ai/prod-api/api/school/getCourseTrainingList',
    type: 'POST',
    data: jsonData,
    contentType: 'application/x-www-form-urlencoded',
    success: function(response) {
        // 请求成功时的处理逻辑
    },
    error: function(xhr, status, error) {
        // 请求失败时的处理逻辑
    }
  });  
</script>

;