javascript
var param = "url=" + $("#url").val();
$.ajax({
type: "POST",
url: "targetAction!targetMethod.action",
data: param,
dataType: "json",
success: function(json){
alert(json);
},
error:function(){
alert("连接超时");
}
});
java
ServletResponse response = ServletActionContext.getResponse();
response.resetBuffer();
response.setCharacterEncoding("utf-8");
response.getWriter().print(JSONArray.fromObject(data));
js端需要有个jquery,java端需要有个json-lib,这两个你可以到网上下载