由4部分組成:JS + CSS + DOM + XMLHttpRequest
案例:實(shí)現(xiàn)ajax異步通信,局部刷新。開(kāi)發(fā)環(huán)境:tomcat服務(wù)器(必須)。。
ajax_1_1.html:



































將上述doajax換成 "POST" 方法請(qǐng)求ajax:












ajax_2_2.jsp:(注意字符編碼問(wèn)題)


將上述返回值的形式改為 XML: ( 只要改一下回調(diào)函數(shù)。Action中需要設(shè)置response.setContentType("text/xml;charset=utf-8"); )












* Action返回給ajax數(shù)據(jù)的方式:response.getWriter().println("responseText");