Home > Back-end >  Thymeleaf th: onclick pass parameters configuration at the same time the href="JavaScript: void
Thymeleaf th: onclick pass parameters configuration at the same time the href="JavaScript: void

Time:10-04


 & lt; A href="javascript: void (0)" th: text="${post. The title}" th: onclick="| seeContent (${post. Post_id}) |" & gt;  


 function seeContent (postId) {
$. Ajax ({
Url: '/msgContent,
Type: "POST",
DataType: 'json,
Data: {: postId postId},
Success: the function (data) {

}
})
}

 @ RequestMapping ("/msgContent ") 
@ ResponseBody
Public String findMsgContent (String postId, Model mode) {
System. The out. Println (postId);
PostTopic msgContent=postService. FindMsgContent (postId);
System. The out. Println (msgContent);
Mode. The addAttribute (" content ", msgContent);
Return "user_ms. HTML";
}
there are output value, but only user_ms. HTML page can not jump the save the children

CodePudding user response:

Don't sink to the individual
  • Related