Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var tagTexts = $(ul li.select2-selection__choice")
- .toArray()
- .map(function(i){
- return i.innerText;
- });
- tagTexts = JSON.stringify(tagTexts);
- $.ajax({
- type: 'POST' ,
- url: '/tag/tagList',
- dataType: 'json',
- data: {
- tagTexts: tagTexts
- },
- error: function(err) {
- console.log(err);
- },
- success: function(response) {
- //Process Response
- }
- });
- @ResponseBody
- @RequestMapping(value = "/tag/tagList", method = RequestMethod.POST)
- public String saveTagList(HttpServletRequest request,
- @RequestParam(value = "searchTagTexts", required = false)String tagListString) {
- try
- {
- List<String> tagTexts = (List<String>)mapper.readValue(tagListString, new TypeReference<List<String>>() {});
- System.out.println(tagTexts);
- String response = tagService.saveTags(tagTexts);
- return response;
- } catch (JsonGenerationException e) {
- e.printStackTrace();
- } catch (JsonMappingException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- return null;
- }
- "["Drone", "Richard Feynman, PHD", "Yatch","Tik—Tok"]"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement