i want to submit my form to a specific url using $.post
, i followed exactly what the tutorial told me. this is my code
$(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();
});
});
but when i press the submit button, i just have new question mark in the url, i mean this
the url of the form before submit
http://localhost:42344/WebForm1.aspx
the url of the form after submit
http://localhost:42344/WebForm1.aspx?
what am i doing wrong pelase?
note
i can alter the value of password and mobilenumber