Passing the parameter via Ajax

  • How to pass the parameter via Ajax Calling URL....
Here you can get the value from term Its realyy fantastic to have this thing in ajax....
****************************************************
$(document).ready(function() {
        $(function() {
                $("#search").autocomplete({     
                source : function(request, response) {
                $.ajax({
                        url : "SearchController",
                        type : "GET",
                        data : {
                                term : request.term
                        },
                        dataType : "json",
                        success : function(data) {
                                response(data);
                        }
                });
        }
});
});
});
*******************************************************
in controller get the value...
try {    String term = request.getParameter("term");
         System.out.println("Data from ajax call " + term);  }
catch (Exception e) {
                        System.err.println(e.getMessage());
                }
*************************************************************

Thanks 
Pavan (P1)

Comments

Post a Comment

Popular posts from this blog

How to resolve session timeout issue in JAVA

Blog gives you enthusiasm,zeal

How to encode HTML in JAVA (Remove HTML from your text)