• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Display / Hide Table based on output

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have the following requirement:
I have a servlet that calls an ajax script and accordingly displays the result in a table. When I first load the page , I need to hide the table and once I click on a button 'Charge' I need to call the ajax function and display the result in the table by making it visible ? How do i achieve this ? Any help is appreciated.

Following is snipped of my existing code


My ajax script:
 
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
CSS. Make the table hidden until script makes it visible.

Why are you building up HTML in servlet? Gather the data in the servlet then forward to a JSP to format the table HTML.
 
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
You can use jstl tag, jsp scriptlet or javascript to achieve it.
 
Bear Bibeault
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Miku Ranjan wrote:Hi,
You can use jstl tag, jsp scriptlet or javascript to achieve it.


No, you can't. Not when using Ajax to fetch the new table.
 
Miku Ranjan
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Yes Bear is right if you are using ajax that simply you can use some javascript to change the css to hide /show.
 
reply
    Bookmark Topic Watch Topic
  • New Topic