• 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

how to get an object reutrned by javascript?

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am making a social networking website where in i am adding the functionality of letting people being tagged in photos.For this i have to store the co-ordinates of the tag window and send them to servlet so that i can store them in a databse.
However the code which i have ,stores the co-ordinates in javascript function.(Heres the javascript code):


Now how do i get the variables pos_x,pos_y,pos_width,pos_height and send them to a servlet.


Heres one approach which i applied:I created an object and stored the co-ordinates inthat object in the above javascript code like this:


However i do not know how to get the returned object (namely "coordinates")in my html calling code.Hers how i call the above javascript function:
<input type='button' value='Add Tag' onclick='return addTag()' />

Please suggest me an approach or help me correct my approach.
 
Greenhorn
Posts: 24
Eclipse IDE Oracle Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What you are planning to do is to send the values (coordinate object) to the servlet on click of the button using ajax.

So change the



to

 
Manas Saxena
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi thanks for the reply.Though i found another work around .
I sent the parameters in the javascript function to the servlet via ajax call.
 
Opportunity is missed by most people because it is dressed in overalls and looks like work - Edison. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic