日期:2014-05-17 浏览次数:20820 次
$.ajax({
url : "findContentByid.action",
cache : false,
type : "post",
dataType : "json",
data : {mid : id},
success: function(data){
alert(data);
var json = eval("("+data+")");
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert("读取服务器数据失败...");
}
});
<package name="ajaxmessage" extends="json-default" namespace="/">
<action name="findContentByid" class="messageAction" method="findContentByid">
<result type="json" name="findajaxmc">
<param name="root" >result</param>
</result>
</action>
</package>
public String findContentByid(){
Map<String, String> map = new HashMap<String, String>();
map.put("details", "a");
JSONObject jsonobject = JSONObject.fromObject(map);
result = jsonobject.toString();
System.out.println(getResult());
return "findajaxmc";
}