How JavaScript handles List_javascript tips for returning from Java background

Source: Internet
Author: User
Things:

Returns list<string> type data from the Java background for interface display. But JS wants to get it and manipulate it. Using the EL expression directly, JS identifies it as a string. It's not what I want. Search the Internet to search the solution ... The best course is to turn the list into a JSON format and upload it to the interface. This JS inside the operation is also simple, the page has no effect.

Solve:

Turn list<string> into JSON and upload to the interface. Use var arr = eval (' ${list} ') in JS, and turn the list into a JS array.

My Code:
Copy Code code as follows:

var keylist = eval (' ${keyslist} ');
var values = $ ("#paramsValues"). Val ();

var noset = [];

for (Var i=0;i<keylist.length;i++) {
if (Values.indexof (Keylist[i]) ==-1) {
Noset.push (Keylist[i]);
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.