Taiwan before and after separation

When separating the front and back, to add annotations @CrossOrigin Controller layer in the foreground data access
注:
@CrossOrigin:允许跨域,用于前后端分离
code behind can be compiled successfully Insomnia testing software.
Reception code can not develop because the individual can not be used like jstl dynamic code, all need to be transmitted with the request received through ajax, so that various information can not be tucked back through the session scope, and depends on background information returned by the code reception jq the information session is equivalent to the front desk tucked among domain scope

<script>
    $(function(){
        $.post(
            'http://localhost:8888/user/login',
            {},
            function(res){
            // 存 取对象都需要JSON对其进行处理
            sessionStorage.setItem("login_user",JSON.stringify(res));
                       //
            let user = sessionStorage.getItem("login_user");
            },
            'json'
        )
    })
</script>

Reproduced in: https: //www.jianshu.com/p/ef74012607a3

Guess you like

Origin blog.csdn.net/weixin_33978044/article/details/91051918