zoukankan      html  css  js  c++  java
  • springboot前端向后端请求返回html语句

    后端接口代码

       @PostMapping("/service/confirmPay")
       @ResponseBody
       public GlobalResponse confirmPay(HttpServletRequest request, HttpServletResponse response, HttpSession session) {
            //调用方法
            String html = createHtml(payUrl, httpMap);
            return GlobalResponse.success(html);
       }
    
    
    	public static String createHtml(String action, Map<String, String> paramMap) {
    		StringBuilder html = new StringBuilder();		
    		html.append("<form id="submitForm" name="submitForm" action="").append(action).append("" method="post">
    ");
    		for (String key : paramMap.keySet()) {
    			html.append("<input type="hidden" name="" + key + ""  value='" + paramMap.get(key) + "'>");
    		}
    		html.append("</form>
    ");
    		return html.toString();
    	}
    

    前端页面代码(js)

    $.post(contextPath + '/service/confirmPay', param , function (res) {
    			if(res.success){
    				$("#payform").html(res.data);//获取后台返回的页面代码
    			}else{
    				layer.msg(res.alertMsg, {
    	                time: 1600,
    	                offset: ['40%']
    	            });
    			}
            })
    
  • 相关阅读:
    pandas 分组过滤
    bert fine tuning方法
    对字典进行排序
    1*1的卷积的作用
    使用Conv代替全连接层FC
    训练笔记
    javascript 正则分组捕捉
    谷歌浏览器 喔唷,崩溃啦
    sed awk
    c# 通过程序修改hosts文件
  • 原文地址:https://www.cnblogs.com/wtao0730/p/15099244.html
Copyright © 2011-2022 走看看