通过 POST 发送参数而不是直接在 JQuery 验证库的远程规则中使用 GET?

Send Parameter via POST Instead of GET in remote rule of JQuery Validation Library directly?

我正在努力学习 JQuery,并试图理解 validate 库 (https://jqueryvalidation.org/) 中的各种规则。 但是,我注意到即使我的 HTML <form id="myform">method="POST",对我的 check-email.php 的远程请求也是通过 GET 而不是 POST 发送的。这是我正在使用的 validate 规则:

$( "#myform" ).validate({
    rules: {
        email: {
            required: true,
            email: true,
            remote: "check-email.php"
        }
    }
});

我想知道如何在不使用任何显式 AJAX.

的情况下通过 POST 而不是 GET 将请求发送到 check-email.php

任何帮助将不胜感激。

I am wondering how I can send the request to check-email.php via POST instead of GET without any explicit AJAX.

这甚至没有意义。由于 remote 方法是通过 ajax() 实现的,因此在没有 Ajax 的情况下使用 remote 是完全不可能的。

the remote request to my check-email.php is sent via GET and not POST

Following the docs,您可以使用任何 jQuery .ajax() 设置。

所以只需将 type 设置为 POST...

$( "#myform" ).validate({
    rules: {
        email: {
            required: true,
            email: true,
            remote: {
                url: "check-email.php",
                type: 'POST'
            }
        }
    }
});