日期:2014-05-17 浏览次数:20617 次
$(function(){
setInterval(function send(){
$.ajax({
url:'send.do',
type:'post',
dataType:'json',
success:function(data,statusText){
//不弹
alert(data);
}
}
);
},3000);
});
private static String msg="hello";
private static int num=0;
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
System.out.println("====send====");
PrintWriter out=response.getWriter();
out.print(msg+new SimpleDateFormat("yyyy-mm-dd HH:MM:SS").format(new Date())+num++);
System.out.println("num:"+num);
out.close();
}