wzwd111 发表于 2013-2-7 14:53:36

AJAX

附件有简单封装的AJAX对象的引用以及请求服务器的方法
 
AJAX后台如何处理response流以供前端使用
int flg = ProductAcceptMaint.checkReference(sReference);
   response.reset();
   java.io.PrintWriter out = response.getWriter();
   response.setContentType("text/html;charset=GBK");
   out.print(flg);
 
不能用out.write,而且注意在此之前response是否有值    //待定
 
//responseText处理
str=str.replace(/^\s+|\s+$/,"");
 
 
AJAX提交对于“%”的处理,escape()
var url = "ReferenceWorkNo?flg=checkWorkNo&workNo="+escape(workNo);
                   // Open a connection to the server
                   xmlHttp.open("GET", url, true);//true is asyn
                   // Setup a function for the server to run when it's done
                   xmlHttp.onreadystatechange = dealWorkNoResult;
                   // Send the request
                   xmlHttp.send(null);
var xmlDoc=xmlHttp.responseXML.documentElement;xmlDoc.getElementsByTagName("compname").childNodes.nodeValue; 
//2级联动?
http://www.java3z.com/cwbwebhome/article/article2/2278.html?id=800
页: [1]
查看完整版本: AJAX