Home >Web Front-end >JS Tutorial >How javaScript handles list_javascript tips returned from java background

How javaScript handles list_javascript tips returned from java background

WBOY
WBOYOriginal
2016-05-16 16:51:172272browse

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