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
Release: 2016-05-16 17:07:48
Original
1096 people have browsed it

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);

}
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template