I created a jsp page with 2 variables and using jquery that is passed to Servlet and displayed in console, now i need to pass a variable back to jquery.How to write it??Please see the servlet and js i used.
jquery
$(document).ready(function(){
$("#click").click(function(){
     var form = $('#new');
       alert("serialize :"+form.serialize());
           $.ajax({
               url: 'login',
               data: form.serialize(),
               type: 'post',
               success: function(data){ 
                   alert("Reached Servlet"+data);
               }
                   });
});
});
Servlet do post as follows
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("in POST");
        String a=request.getParameter("txt_name");
        String ad=request.getParameter("txt_address");
        PrintWriter ins_writer= response.getWriter();
        System.out.println("console");
        ins_writer.write("In servlet POST > value for Name : "+a);
        System.out.println("a > "+a +">>>>>"+ad);
        System.out.println("----------------------------From Jquery-------------");
        System.out.println("Name  from JSP> "+a);
        System.out.println("Address  from JSP> "+ad);
         String pq="Amanda";       
    }
I just wanted to pass this 'pq' value to jquery ?Please help me!!
 
     
     
    