如何通过在 featherlight 请求中发送 POST 数据而不是 GET 来加载带有 ajax 内容的 Featherlight 模态?
$.featherlight({
ajax: 'some.php'
});
以上代码将从“some.php”加载内容。如果我想发送 POST 值怎么办?
例如,对于 jQuery,我会使用:
$.ajax({
method: "POST",
url: "some.php",
data: { name: "John", location: "Boston" }
})
那会传递一些 POST 数据。这就是我试图用 featherlight.js 完成的。这可能吗?
最佳答案
老问题,但是,万一有人掉在这里:
正如约翰尼所建议的,并根据 documentation , Featherlight 不为 AJAX POST 提供任何内置功能。</p>
但是,您可以发出 POST 请求并使用响应调用 featherlight:
$.post(myUrl, myData, function (response) {
$.featherlight(response, configuration);
}
关于javascript - featherlight ajax 发布请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35556949/