2010-09-17 32 views

回答

0

我得到了答案。

將URL -

URL = Controller.action PARAM = 「值」

0
xmlHttp.open("GET","yourNameSpace/yourActionName?property=value1&property2=value2",true); 

xmlHttp.send(); 

不要被yourNameSpace在上述

混淆檢查?命名空間屬性在struts.xml/struts-config.xml文件中標記並在那裏給出相同的標記。

如果要單獨發送參數,請使用以下給出的post ajax請求。

var params = "property1=value1&property2=value2"; 

xmlhttp.open("POST","yourNameSpace/yourActionName",true); 

xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 
xmlhttp.setRequestHeader("Content-length", params.length); 
xmlhttp.setRequestHeader("Connection", "close"); 

xmlhttp.send(params); 
} 

希望這會有所幫助。