Guest User

Untitled

a guest
Feb 21st, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorate="~{templates/layout}"
  3. xmlns:th="http://www.thymeleaf.org">
  4.  
  5.  
  6. <body>
  7. <section layout:fragment="content">
  8. <div class="transaction" th:if="${!transactions.isEmpty()}">
  9. <div class="columns" th:object="${transactions[0]}">
  10.  
  11. <div class="level main-dev">
  12. <div class="column is-one-fifth has-text-centered code-dev">
  13. <p class="title" th:text="*{transactionCode}"></p>
  14. </div>
  15.  
  16.  
  17. </div>
  18. </div>
  19. </div>
  20. </section>
  21. <th:block layout:fragment="script">
  22. <script th:src="@{/resources/js/transaction-page.js}"></script>
  23. </th:block>
  24. </body>
  25. </html>
  26.  
  27. $('.search-btn').click(function (event) {
  28. var element = $(this);
  29. event.preventDefault();
  30.  
  31. var searchRequest = {};
  32. searchRequest["merchantCode"] = $('#merchantCode').val();
  33.  
  34. url = $('#transactionSearchDTO').attr("action");
  35.  
  36. $.ajax({
  37. type: "POST",
  38. contentType: "application/json",
  39. url: url,
  40. data: JSON.stringify(searchRequest),
  41. dataType: 'json',
  42. cache: false,
  43. beforeSend: function (xhr) {
  44. xhr.setRequestHeader("Accept", "application/json");
  45. xhr.setRequestHeader("Content-Type", "application/json");
  46. },
  47. success: function (data) {
  48. console.log("SUCCESS: ", data);
  49. },
  50. error: function (e) {
  51. console.log("ERROR: ", e);
  52. },
  53. done: function (e) {
  54. console.log("DONE");
  55. }
  56. });
  57.  
  58. });
  59.  
  60. @RequestMapping(method = RequestMethod.POST)
  61. @ResponseBody
  62. public SearchResponseDTO getTransactionListForSearch(Model model, @RequestBody Map<String, String> dataMap) throws TransactionRetrievalException, RestRequestException {
  63. TransactionSearchDTO transactionData = new TransactionSearchDTO();
  64. transactionData.setMerchantCode(dataMap.get("merchantCode"));
  65. List<TransactionDTO> transactions = cardTransactionService.getTransactionList(transactionData);
  66. return new SearchResponseDTO(transactions,false);
  67. }
Add Comment
Please, Sign In to add comment