前端主要代码块如下:
$("#saveDbRequest").click( function() {
$.ajax( {
type : "get",
url : "http://hsz-12532:8888/rsms/dbCreatedQuestionController.any?saveFlag=saveFlag&",
data : encodeURI($("#formMain").serialize()),
dataType : "jsonp",
jsonp: "callbackparam",
jsonpCallback:"success_jsonpCallback",
success : function(data) {
$("#requestPaperNum").html(data.noMergeDBMsg);
$("#dbDetail").show();
$("#newCreateDbFrame").attr("title","hide");
},
error : function() {
}
});
});
后台的主要处理代码如下:
try{
dbRequestRecord.setDbRequestNum(UUID.randomUUID().toString().replaceAll("-", ""));
dbRequestRecordService.addBaseBean( dbRequestRecord, null);
DbRequestConclusion tp = new DbRequestConclusion();
tp.setNoMergeDBMsg(dbRequestRecord.getDbRequestNum());
JSONObject jsonObject = JSONObject.fromObject(tp);
response.setCharacterEncoding("utf-8");
PrintWriter out = response.getWriter();
out.write(request.getParameter("callbackparam")+"("+jsonObject.toString()+")");
out.close();
}catch(Exception e){
e.printStackTrace();
}