Home >Web Front-end >JS Tutorial >Reasons and solutions for not getting value when writing el expression in js file_javascript skills

Reasons and solutions for not getting value when writing el expression in js file_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:07:481112browse

Today in the js file, the value cannot be obtained by writing the el expression (the code is as follows). After Baidu browsed it, the summary is as follows:

1. JavaScript is executed on the client side, EL is executed on the server side, and the service The client executes before the client, so the value cannot be obtained

2. 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 code The code is as follows:

$(function(){

var isLogin="${isLogin}";
if(isLogin==='1 ')
{
typeShow(".congra");
}
//Not from the active page
else if(isLogin==='10001')
{
typeShow(".randToContent");
setTimeout(function(){
window.location.href=randUrl;
}, 3000);

}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn