返回html实例

js

<script>
        $(document).ready(function() {
            $(document).ready(function() {
                $.ajax( {
                    url : '/wd/toupiao/test',
                    type:'GET',
                    dataType : 'html',
                    success : function(a) {
                        $("#vue").html(a);
                    }
                });
            });
        });

	</script>

html

<div class="wrap">
	<div class="lg-container" id="vue">
	</div>
</div>

后台(返回到指定html页面)

@RequestMapping(value = "test",method = RequestMethod .GET,produces="text/html;charset=UTF-8;")
	public String test(HttpServletResponse response, HttpServletRequest request){
		try {
			request.setCharacterEncoding("utf-8");
			response.setCharacterEncoding("utf-8");

			return "/test";
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return "/test";
		}
	}

猜你喜欢

转载自blog.csdn.net/qq_33391644/article/details/81746403