を使用してフォームを特定の URL に送信したいのですが$.post
、チュートリアルに書かれていることを正確に実行しました。これは私のコードです
$(document).ready(function () {
$("#fLogin").on('submit', function (e) {
var errorCount = 0;
$('span.errorMessage').text('');
$('input [type=text]').each(function () {
var $this = $(this);
if ($this.val() === '') {
var error = 'Please fill ' + $this.prev('label').text(); // take the input field from label
$this.next('span').text(error);
errorCount = errorCount + 1;
}
});
var select = $('#sUserType').filter(function () {
if (this.selectedIndex == 0)
errorCount = errorCount +1;
return this.selectedIndex == 0;
}).next('span').text('Please select user type');
if (errorCount == 0) {
var mobileNumber = $("#iMobileNumber").val();
var password = $("#iPassword").val();
$.post("MY URL");
//$.ajax("ajax/test.html", function (data) {
// alert("d");
//});
}
else
e.preventDefault();
});
});
しかし、送信ボタンを押すと、URLに新しい疑問符が表示されます。つまり、これです
送信前のフォームの URL
http://localhost:42344/WebForm1.aspx
送信後のフォームの URL
http://localhost:42344/WebForm1.aspx?
私は何を間違っていますか?
ノート
パスワードと携帯電話番号の値を変更できます