📌  相关文章
📜  jquery 检查输入是否为空 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:37.079000             🧑  作者: Mango

代码示例4
if ($.trim($("user_name_intend").val()).length != 0 &&
            $.trim($("user_telephone_intend").val()).length != 0 &&
            $.trim($("user_email_intend").val()).length != 0 &&
            $.trim($("user_comment_intend").val()).length != 0) {
            $.ajax({
                url: "/makeOrder",
                type: "POST",
                data: {
                    quantity: 1,
                    min_quantity: 1,
                    max_quantity: 100,
                    name: $('#user_name_intend').val(),
                    telephone: $('#user_telephone_intend').val(),
                    email: $('#user_email_intend').val(),
                    comment: $('#user_comment_intend').val(),
                    product_id: {{ product_id }},
                },
                dataType: "json",
                success: function (t) {
                    $("#intendformpost").submit();
                },
            });
        } else {
            alert("Kerakli maydonlar to'ldirilmagan")
        }