ajax同步/异步post请求(参数含数组等)
1 <script> 2 let post_data = {ids: [1, 2, 3]} 3 try { 4 $.ajax({ 5 type: 'POST', 6 url: 'url', 7 async: false, // false: 同步请求, true: 异步请求 8 data: post_data, 9 traditional: true, 10 dataType: 'json', 11 success: function (message) { 12 } 13 }) 14 } catch (e) { 15 console.error(e) 16 } 17 </script>