值在頁面like this,我能寫什麼樣的代碼,以阻止該網頁發送GET請求(或POST請求)?檢索密碼字段
頁:
<body>
<p>Let's do the login thing
<br>
</p>
<form id="keyform">
<table>
<tr>
<td>
<div class="midform">
<input type="text" id="id" placeholder="ID">
<br>
<input type="password" id="key" placeholder="Password">
</div>
</td>
<td>
<div class="submitform">
<input type="submit" id="submit" value="Log in">
</div>
</td>
</tr>
</table>
</form>
<div id="output"></div>
</body>
代碼:
d3.select("#keyform").on("submit", function() {
console.log(d3.select('#key').property("value"));
return false;
});
我打算捕捉提交密碼的值,通過MD5運行它,並將其發送到服務器與哈希比較一個數據庫。但點擊「提交」會導致頁面發送GET,這是不可取的。
將表單方法設置爲'發佈' – 2014-11-02 09:21:13
將輸入從提交更改爲文本並自行處理。 – Craicerjack 2014-11-02 09:25:25
@ŁukaszTrzewik這是行不通的,因爲我需要** **之前爲MD5它張貼。 – Sky 2014-11-02 10:47:21