i am letting user enter some data in text field, and on button press,i am calling below JQuery function and making Ajax call inside.
Below is my JQuery Function and Input field details.
$("#SearchByVIN").click(function() {
$("#error").hide();
var formData = $('#vinSerach').serialize();
$.ajax({
type: "POST",
url: "ErrorVin",
data: formData,
crossDomain: false,
async : true,
success: function(response) {
if(response){
$("#error").show();
$("#error").html(response);
$(window).scrollTop($('#error').offset().top);
}else{
$("#searchResult").show();
$("#searchResult_info").show();
$("#searchResult_paginate").show();
var oTable = $('#searchResult').dataTable( {
"bDestroy": true,
"iDisplayLength": 2,
"bFilter": false,
"bFilter": false,
"bLengthChange": false,
"sAjaxSource": "SearchByVIN",
"aoColumns": [
{ "mData": "gdId" },
{ "mData": "agency" },
{ "mData": "documentType" },
{ "mData": "countyName" },
{ "mData": "organizationName" }
]
} );
}
},
error: function(result){
alert(result);
}
});
});
Note that, first i am calling url: "ErrorVin", method in controller. In which, i am properly recieving data in controller using Form Bean. But when it comes in else, i am using "sAjaxSource": "SearchByVIN", but in this case, i am not revieving any jsp input values in controller method mapped with this url. So, if i want to pass input values from my input parameter in this second call, how can i achieve that?