1.客户端和正常调用非跨域接口一样
2.服务端
返回的时候用callback+(返回值)的方式返回结果. callback为客户端的隐藏参数.
public String converJsonResultSimple(String jsonString ,String callback){
if(callback!=null && !"".equals(callback)){
jsonString = callback + "(" + jsonString + ")";
}
return jsonString;
}
@RequestMapping(value = "/uploadUserBehaviorInfo", method = {RequestMethod.GET,RequestMethod.POST})
public String uploadUserBehaviorInfo(String data,String callback){
Sting resutStr = data+"处理结果";
return converJsonResultSimple(resutStr,callback);
}