Today in the js file, the value cannot be obtained when writing the el expression (the code is as follows). After searching on Baidu, the summary is as follows:
1. JavaScript is executed on the client side, EL is executed on the server side, and the server side executes it before the client side, so the value cannot be obtained.
2. If you want to get the value of "${isLogin}", you can use a global variable to receive it in jsp, and then use it in js.
3. Note: When using, be sure to add double quotes, such as var isLogin="${isLogin}";
Copy the code code as follows:
$(function(){
var isLogin="${isLogin}";
if(isLogin===='1')
{
typeShow(".congra");
}
//Not from the event page
else if(isLogin==='10001')
{
typeShow(".randToContent");
setTimeout(function(){
window.location.href=randUrl;
}, 3000);
}