How can i pass input data from JSP to data table and receive on Controller?

How can i pass input data from JSP to data table and receive on Controller?

aksh2143aksh2143 Posts: 1Questions: 1Answers: 0

Hi, 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);
                    }
                });
    });

<td>
<form:input path="vin" class="input-xxlarge" placeholder="VIN"></form:input>
<button name="SearchByVIN" id="SearchByVIN" value="Search By VIN" class="btn" type="button">Search By VIN</button>
</td>

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 in this second call, how can i achieve that?

Sign In or Register to comment.