3 回答

TA貢獻(xiàn)1853條經(jīng)驗 獲得超6個贊
如果您確實希望將請求方法保留為 GET,則可以將 an 應(yīng)用于id您的form標(biāo)簽;然后將 an 添加onclick="submitForm()"到您的input標(biāo)簽(這也適用于img標(biāo)簽或任何標(biāo)簽)。然后我們將用一些簡單的 JavaScript 代碼定義我們的函數(shù)。希望我有幫助!
<form id="form" method="GET" action="/filtered">
<div class="slider-wrapper"><!-- innermost wrapper element -->
<input onclick="submitForm()" class="slide" type="image" style="width: 100%; height: 60vh;" name="category" value="Car Cleaning Products" alt="Car Cleaning Products" src="../public/css/img/paper-products-slideshow.JPG">
</div>
</form>
<script>
function submitForm() {
document.getElementById("form").submit();
}
</script>

TA貢獻(xiàn)1789條經(jīng)驗 獲得超10個贊
使用method="post"
get是獲取數(shù)據(jù)而不是發(fā)送數(shù)據(jù)。
我相信這會起作用

TA貢獻(xiàn)1827條經(jīng)驗 獲得超9個贊
只需將form方法更改為POST即可。
<form method="POST" action="/filtered">
<div class="slider-wrapper">
<!-- innermost wrapper element -->
<input class="slide" type="image" style="width: 100%; height: 60vh;" name="category" value="Car Cleaning Products" alt="Car Cleaning Products" src="../public/css/img/car-cleaning-slideshow.JPG">
<input class="slide" type="image" style="width: 100%; height: 60vh;" name="category" value="Car Cleaning Products" alt="Car Cleaning Products" src="../public/css/img/jan-supplies-slideshow.JPG">
<input class="slide" type="image" style="width: 100%; height: 60vh;" name="category" value="Car Cleaning Products" alt="Car Cleaning Products" src="../public/css/img/paper-products-slideshow.JPG">
</div>
</form>
添加回答
舉報