Skip to content
Advertisement

How to print Java object in modal using jQuery

I am trying to print object data in modal using jQuery. When I click the button it sends the Java object to jQuery and then prints it but it is printing in this format:

Trip [tid=1, tname=North, tplace=Ladhak, tpackage=12000, tfrom=2022-05-21, tto=2022-05-31, lastdate=2021-12-22, tinfo=XYZ]

I want to access data of the object and display it.

JavaScript

jQuery code:

JavaScript

Advertisement

Answer

  1. Split your data to get desire shape using .split(' ') .
  2. Remove unnecessary character from data.
  3. Inside loop generate markup.
  4. Append markup on desire div.

JavaScript
JavaScript
JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement