Home > Web Front-end > JS Tutorial > body text

How javaScript handles list_javascript tips returned from java background

WBOY
Release: 2016-05-16 16:51:17
Original
2178 people have browsed it

Things:

Return List type data from the java background for interface display. But I want to get it and operate it in js. Use the EL expression directly, and js will recognize it as a string. Not what I want. . I searched online for everyone's solutions... The best one is of course to convert the List collection into json format and transfer it to the interface. In this way, the operation in js is simple and the page will not be affected.

Solution:

Convert List into json and pass it to the interface. In js, use var arr = eval (‘${list}’); to convert the list into a js array.

My code:

Copy code The code is as follows:

var keyList = eval('${keysList}');
var values ​​= $("#paramsValues").val();

var noSet = [];

for(var i=0;iif(values.indexOf(keyList[i])==-1){
noSet.push(keyList[i]);
}
}
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!