为什么ajax返回了整个页面?急!
struts.xml配置
<package name="evaluate" namespace="/evaluate" extends="json-default">
<action name="escore_*" class="com.firehonest.action.EvaluateActivityscoreAction" method="{1}">
<result name="calscore" type="json"></result>
</action>
</package>
public class EvaluateActivityscoreAction extends ActionSupport{
private String result;
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
public String calscore(){
result = "ok";
return "calscore";
}
}
<html>
<head>
<script>
function f(){
$.ajax({
type: "GET",
url: "escore_calscore.action",
dataType : "text",
success: function(data){
alert(data);
}
});
}
</script>
</head>
<body>
<input type="button" onclick="f()">
</body>
</html>
我服了you,发了贴没看吗?
是的,谢谢,还有如果url地址不变的话第二次访问然后好像就不执行,怎么在后面加个时间戳的?