我有一个网站,其中包含一些个人数据。当我使用 $.post 时,消息会附加到 URL 中。提交表单时也是index.html
如此。index.html?message=Hey+what's+up%3F
如何防止这种行为?
jQuery:
$(form1Var).submit(function() {
$.post("submit.php", form1Var.serialize(), function(data) {
var code = data.trim();
console.log(code);
$('[data-role="response"]').html('<span class="ui-btn-text">' + code + '</span>');
$('[data-role="submit"]').load("submit_form.html");
});
});
表格:
<form name="submit_message" action="" id="message_form">
<div data-role="fieldcontain" class="ui-field-contain ui-body ui-br">
<label for="textarea" class="ui-input-text">Message:</label>
<textarea maxlength="10000" cols="40" rows="8" name="message"
id="message" class="ui-input-text ui-body-null ui-corner-all ui-shadow-inset ui-body-c"></textarea>
</div>
<div data-theme="a" class="ui-btn ui-btn-corner-all ui-shadow ui-btn-up-a"
aria-disabled="false">
<span class="ui-btn-inner ui-btn-corner-all">
<span class="ui-btn-text">Submit</span>
</span>
<button type="submit" data-theme="a" name="submit" value="submit-value"
class="ui-btn-hidden" aria-disabled="false">Submit</button>
</div>
</form>