js碎片
1、当单击button时如果未选中任何一个多选框则给出提示警告
1 $('#account').click(function () { 2 var check_count = $("tbody").find(":checked").parents("tr").length; 3 if (check_count == 0) { 4 common_ops.alert('请先选择需要结算的商品!'); 5 return false; 6 } 7 });
2、ajax提交数据
<script>
var data = {
"username": "apple",
"password": "123456"
};
$.ajax({
url: 'http://10.10.92.232:5000/auth',
type: 'post',
contentType:'application/json',
data:JSON.stringify(data), //发送json格式数据
success:function (res) {
console.log(res)
},
error:function (e) {
console.log(e)
}
})
</script>
ps:ajax中的contentType: https://www.cnblogs.com/htoooth/p/7242217.html
天青色等烟雨而我在等你!

浙公网安备 33010602011771号