前端代码:
$.ajax({
url:'http://localhost:8080/OA/json/json.action?orgid=aaa&code=00002',
dataType:'jsonp',
type:"GET",
dataFilter:function(json,me){
alert("dataFiter:"+json);
},
contentType : "application/json-rpc",
jsonpCallback : "call",
success : function(response,status,xhr){
alert(response);
},
error : function(xhr,errText,errStatus){
alert("error");
}
});
后台配置:
<package name="json" namespace="/json" extends="json-default">
<action name="json" class="jsonTest" method="shareInfo">
<interceptor-ref name="json"></interceptor-ref>
<result type ="json" name="success">
<param name="noCache">true</param>
<param name="contentType">text/html</param>
</result>
</action>
</package>
老是提示:Uncaught SyntaxError: Unexpected token :
从network中看到的response数据是json格式的,在线解析也成功了。