ajax jsonp

1.js

$.ajax({
 type:'get',
 url:'http://172.16.15.98:8080/demo/sys/login.do?username=sa&password=1',
 dataType:'jsonp',
 jsonpCallback: "success_jsonpCallback",
 success:function(json){
alert(json.success);
    }
});

2.demo系统Action处理:

返回格式为:callback({"success":true,"message":"操作成功"})

String json = this.userService.login(request, response);
String jsonpCallback = request.getParameter("callback");
json = jsonpCallback+"("+json+")";
this.setJsonString(response, json);