I have a simple form that uses jquery and a servlet. The jquery makes an ajax call to the servlet, the servlet makes some server side calculations, then displays the result
I know many people have answered but i'll show my entire code in 2020
$(document).ready(function () {
$("#PaymentModeForm").validate({
rules: {
"f_cheque_mode_display": {
required: true,
},
"f_cheque_infavour": {
required: true,
},
"f_cheque_payablein": {
required: true,
},
"f_cheque_address": {
required: true,
},
"f_cheque_mobileno": {
required: true,
},
"f_bank_mode_display": {
required: true,
},
"f_bank_beneficiary": {
required: true,
},
"f_bank_acc": {
required: true,
},
"f_bank_bankname": {
required: true,
},
"f_bank_branchname": {
required: true,
},
"f_bank_ifsc": {
required: true,
},
"f_cod_mode_display": {
required: true,
},
"f_cod_mode_charges": {
required: true,
},
"f_razorpay_mode_display": {
required: true,
},
"f_razorpay_key": {
required: true,
},
"f_razorpay_secret": {
required: true,
}
},
messages: {
"f_cheque_mode_display": {
required: "Enter Payment mode display on website"
},
"f_cheque_infavour": {
required: "Enter Infavour Of",
},
"f_cheque_payablein": {
required: "Enter Payble In",
},
"f_cheque_address": {
required: "Enter Courier Address",
},
"f_cheque_mobileno": {
required: "Enter Mobile No",
},
"f_bank_mode_display": {
required: "Enter Payment mode display on website"
},
"f_bank_beneficiary": {
required: "Enter Beneficiary Name",
},
"f_bank_acc": {
required: "Enter A/C No",
},
"f_bank_bankname": {
required: "Enter Bank Name",
},
"f_bank_branchname": {
required: "Enter Branch Name",
},
"f_bank_ifsc": {
required: "Enter IFSC Code",
},
"f_cod_mode_display": {
required: "Enter Payment mode display on website",
},
"f_cod_mode_charges": {
required: "Enter COD Charges",
},
"f_razorpay_mode_display": {
required: "Enter Payment mode display on website",
},
"f_razorpay_key": {
required: "Enter Key Id",
},
"f_razorpay_secret": {
required: "Enter Secret Key",
}
},
submitHandler: function (form, e) {
e.preventDefault();
var form = $(this);
var url = "/PaymentModeSubmit";
$.ajax({
type: "POST",
url: url,
data: $("#PaymentModeForm").serialize(),
success: function(data)
{
alert(data);
}
});
return false;
}
});
return
});