GET is used to obtain static resources
GET is used to obtain static resources
GET is used to obtain static resources
==============================
Script tag is used to load JS script execution
The format is
<script type="text/javascript" src="/js/source/getConfig.html"> 我是script</script>
src=URL,
The URL can point to a static resource on the server,
It can also point to a method on the server side
<head> <meta charset="UTF-8"> <title>Demo</title> <script type="text/javascript" src="./js/framework/jquery-1.8.0.js"></script> <script type="text/javascript" src="./js/framework/communication.js"></script> <script type="text/javascript"> 我是script</script> <script type="text/javascript" src="/js/source/getConfig.html"> 我是script</script> </head> ------------------------ */ @Controller @RequestMapping("/js/source") public class JSSourceController { /** * Get backend configuration JS <br> * This method returns a piece of JS for the front end to use the Script tag to load <br> * * @return */ @RequestMapping(value = "/getConfig") @ResponseBody public String getConfigJs() { String js = "var g_time= new Date();" + "function justAlert(msg){alert(msg);}" + "justAlert(g_time)"; return js; } }
Runtime
========================
Utilize SCRIPT tags
You can use the SCRIPT tag to send a request to the background. This request is not used to request a script, but only for notification.
You can use the SCRIPT tag to send a request to the background. This request is not used to request a script, but only for notification.
You can use the SCRIPT tag to send a request to the background. This request is not used to request a script, but only for notification.