aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes How to get data at click event in JSP from Javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to get data at click event in JSP from Javascript" Watch "How to get data at click event in JSP from Javascript" New topic
Author

How to get data at click event in JSP from Javascript

srihari miriyala
Greenhorn

Joined: May 16, 2012
Posts: 16
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..


Palak Mathur
Ranch Hand

Joined: Jan 29, 2007
Posts: 313

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?


Palak Mathur | My Blog | TechJaunt | What is JavaRanch? | List of All FAQs
Pongsakorn Semsuwan
Ranch Hand

Joined: May 15, 2011
Posts: 34

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.


A web application developer wannabe from Thailand
My StartUp : http://www.dreamlog.co
Blog : http://pongsakornsemsuwan.wordpress.com
Palak Mathur
Ranch Hand

Joined: Jan 29, 2007
Posts: 313

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

Joined: May 15, 2011
Posts: 34

I'm not sure if he wants that data to be secured or just want some decorations.

His data is already out there anyway.
S Subbu
Ranch Hand

Joined: Mar 20, 2012
Posts: 87

Better to Use Ajax Call, This is the right way to access your data what you need.
srihari miriyala
Greenhorn

Joined: May 16, 2012
Posts: 16
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
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

You've already been given the answer: you must use Ajax to fetch data as the result of a user action.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
srihari miriyala
Greenhorn

Joined: May 16, 2012
Posts: 16
please give me one example how to fetch using ajax.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

http://api.jquery.com/category/ajax/

You do not want to do Ajax in raw JavaScript. Too much work and too many pitfalls.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get data at click event in JSP from Javascript