search
HomeWeb Front-endJS TutorialHow javaScript handles list_javascript tips returned from java background

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
php如何实现Redis的List操作php如何实现Redis的List操作May 26, 2023 am 11:51 AM

List操作//从list头部插入一个值。$ret=$redis->lPush('city','guangzhou');//从list尾部插入一个值。$ret=$redis->rPush('city','guangzhou');//获取列表指定区间中的元素。0表示列表第一个元素,-1表示最后一个元素,-2表示倒数第二个元素。$ret=$redis->l

java中JSONArray互相转换List怎么实现java中JSONArray互相转换List怎么实现May 04, 2023 pm 05:25 PM

1:JSONArray转ListJSONArray字符串转List//初始化JSONArrayJSONArrayarray=newJSONArray();array.add(0,"a");array.add(1,"b");array.add(2,"c");Listlist=JSONObject.parseArray(array.toJSONString(),String.class);System.out.println(list.to

如何使用C#中的List.Sort函数对列表进行排序如何使用C#中的List.Sort函数对列表进行排序Nov 17, 2023 am 10:58 AM

如何使用C#中的List.Sort函数对列表进行排序在C#编程语言中,我们经常需要对列表进行排序操作。而List类的Sort函数正是为此设计的一个强大工具。本文将介绍如何使用C#中的List.Sort函数对列表进行排序,并提供具体的代码示例,帮助读者更好地理解和应用该函数。List.Sort函数是List类的一个成员函数,用于对列表中的元素进行排序。该函数接

Java基础中List常用方法是什么Java基础中List常用方法是什么May 14, 2023 am 10:16 AM

一、List接口简介List是一个有序的集合、可重复的集合。它是继承Collection接口,在List集合中是可以出现重复的元素,可以通过索引(下标)来访问指定位置的元素。二、List常用方法——voidadd(intindex,Obejctelement)方法1.voidadd(intindex,Obejctelement)方法是把element元素插入在指定位置,后面的元素往后移一个元素。2.voidadd(intindex,Obejctelemen

Java中如何将数组转换为ListJava中如何将数组转换为ListApr 19, 2023 am 09:13 AM

一.最常见方式(未必最佳)通过Arrays.asList(strArray)方式,将数组转换List后,不能对List增删,只能查改,否则抛异常。关键代码:Listlist=Arrays.asList(strArray);privatevoidtestArrayCastToListError(){String[]strArray=newString[2];Listlist=Arrays.asList(strArray);//对转换后的list插入一条数据list.add("1"

为什么在Python中list.sort()不会返回已排序的列表?为什么在Python中list.sort()不会返回已排序的列表?Sep 18, 2023 am 09:29 AM

示例在这个例子中,我们先看看list.sort()的用法,然后再继续。在这里,我们创建了一个列表并使用sort()方法按升序排序-#CreatingaListmyList=["Jacob","Harry","Mark","Anthony"]#DisplayingtheListprint("List=",myList)#SorttheListsinAscendingOrdermyList.sort(

java中List中set方法和add方法的区别是什么java中List中set方法和add方法的区别是什么Apr 19, 2023 pm 07:49 PM

前言在Java中的常用的集合接口List中有两个非常相似的方法:Eset(intindex,Eelement);voidadd(intindex,Eelement);这两个方法都是在集合的指定位置插入指定的元素,那么这两个方法到底有什么区别呢?接下来我们通过ArrayList这个我们常用集合实现来看一下这两个方法的差异相同点首先我们来看一下这两个方法在ArrayList中的相同点他们都会在集合的指定位置插入新的元素,例如下面的例子:#在集合的第2位插入一个F#通过add方法插入Listlist=

Java中Json与List、Map、entity怎么互相转化Java中Json与List、Map、entity怎么互相转化May 27, 2023 pm 12:07 PM

第一步:导入依赖com.google.code.gsongson2.8.6第二步:开始使用场景一:转换普通对象(Bean)。1.将普通的JavaBean转换为Json字符串是最常用的操作了,首先创建一个简单的类,例如:Person。publicclassPerson{privateStringname;privateintage;privatebooleanisMale;privateListhobbies;//省略构造器和getter/setter方法,注意重写toString方法,便于查看控

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment