It takes me almost half a day , but I haven't solve it ,I don't know
why .
I would be much appreciate for your help...

$(document).ready(function(){

    alert("can show");

    $("#button").click(function(){

        alert("when click button , can show ");

        $.post("AddComment",null,function(data){                //
AddComment is a servlet name

                        alert("here can't show");

        },"json");
    });
});

servlet ,root ,"servlets/AddComment",

public void doPost(HttpServletRequest request, HttpServletResponse
response)
            throws ServletException, IOException {

            System.out.println("here can't show,that is ,the method
$.post  does not work");
}

servlet config in web.xml:
  <servlet>
    <servlet-name>AddComment</servlet-name>
    <servlet-class>servlets.AddComment</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>AddComment</servlet-name>
    <url-pattern>/servlets/AddComment</url-pattern>
  </servlet-mapping>

Reply via email to