This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to get data at click event in JSP from Javascript  RSS feed

 
srihari miriyala
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..


 
Palak Mathur
Ranch Hand
Posts: 343
IntelliJ IDE Java Spring
  • 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?
 
Pongsakorn Semsuwan
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
IntelliJ IDE Java Spring
  • 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.
 
S Subbu
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
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66142
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • 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
Author and ninkuma
Marshal
Posts: 66142
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • 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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!