Get the App
SLTechnology News&Howtos  ›  Development  › 

How to add background list to assign values to foreground select tags

Shulou Source: shulou.com Published: 2022-06-03 08:39:26 11月15日 Update

This article is about how to add background list to assign values to foreground select tags. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

The code is as follows:

$.ajax ({

Url: "username findUserList.action"

Type: "post"

Success: function (data) {

Var jsonObj=eval ("(" + data+ ")")

$.each (jsonObj, function (I, item) {

JQuery ("# userList") .append ("" + item.userRealName+ "")

});

}

Error: function (text) {}

});

The code is as follows:

Public void findUserList () throws IOException {

List roleuserList = userService.findUserList ()

String json = JSONArray.fromObject (roleuserList). ToString ()

WriteHtml (json)

}

The code is as follows:

Protected void writeHtml (String strData) {

Try {

Response.setContentType ("text/html; charset=UTF-8")

PrintWriter pw = response.getWriter ()

Pw.write (strData)

Pw.flush ()

Pw.close ()

} catch (IOException e) {

Log.error ("writeHtml ()", e)

}

}

Thank you for reading! On "how to add background list to the foreground select tag assignment" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, you can share it out for more people to see it!

Tags: Code foreground background tags content more articles good practical articles read knowledge reference help related Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Docker Xiaomi OPPO Reno Huawei