• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

How to get data at click event in JSP from Javascript

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys,


i've following code..
below code displays the data for me at page load but i need to get that data when the user/client clicks the button...

so please suggest me, how to display the data on click event through javascript..
or give me one example that matches above scenario..


 
Ranch Hand
Posts: 343
Mac OS X Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

srihari miriyala wrote:hi guys,


i've following code..
below code displays the data for me at page load but i need to get that data when the user/client clicks the button...

so please suggest me, how to display the data on click event through javascript..
or give me one example that matches above scenario..




What data are you talking about?
 
Ranch Hand
Posts: 34
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My suggestion is to put your data into a tag ( div/ span ) and use CSS visibility or display property to toggle that tag.
You have to use your javascript function to change the value of CSS property.
 
Palak Mathur
Ranch Hand
Posts: 343
Mac OS X Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Pongsakorn Semsuwan wrote:My suggestion is to put your data into a tag ( div/ span ) and use CSS visibility or display property to toggle that tag.
You have to use your javascript function to change the value of CSS property.



Not a secured way!!
 
Pongsakorn Semsuwan
Ranch Hand
Posts: 34
Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure if he wants that data to be secured or just want some decorations.

His data is already out there anyway.
 
Ranch Hand
Posts: 87
jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Better to Use Ajax Call, This is the right way to access your data what you need.
 
srihari miriyala
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you for replaying....

actually i wanted to get the data(hit Database and get some records) is at the time of button click...please tell me how to do it., if possible give me one example.please
 
Marshal
Posts: 67447
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You've already been given the answer: you must use Ajax to fetch data as the result of a user action.
 
srihari miriyala
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please give me one example how to fetch using ajax.
 
Bear Bibeault
Marshal
Posts: 67447
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://api.jquery.com/category/ajax/

You do not want to do Ajax in raw JavaScript. Too much work and too many pitfalls.
 
Bring me the box labeled "thinking cap" ... and then read this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic