1.后台代码
String dataCallback=request.getParameter("dataCallback");
if(dataCallback!=null){
jsonStr1=(dataCallback+"("+jsonStr1+")");
}
out.write(jsonStr1);
out.close();
前端发送请求调用:
var param = {};
param.thematicType = this._mThematicType;
param.systemType = this._mSystemType;
param.layerName = this.getLayerENName();
param.appendMode = appModel;
param.json = encodeURIComponent(encodeURIComponent(JSON.stringify(this._mData)));
param.serviceMethod = "updateData";
DPS.$.ajax({
type: "post",
url: thematicMap.getUrl() + "/ClusterService",
dataType : "jsonp",
data: param,
jsonp: "dataCallback",
// 异步请求
async: true,
cache: false,
success: function (data) {
},
error: function (res) {
console.log(res)
}
});