• 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:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Sending response to ajax from Java  RSS feed

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Team,

I have a snippet of code like below,



From the above code i want to pass the value comtval as  a parameter to the function  saveEditComment(),and then send this whole html table as response to ajax response,i am getting the response but i could not get the comtval value ,it is also just appended as a string value.
Please find the response from ajax side




can anyone please help me out on how to pass the argument value also.

Thanks in Advance.
D.Srikanth
 
Master Rancher
Posts: 3630
40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This probably ought to be in the Servlets section.

As for the problem itself, I can't tell where you expect the comtval to go.

Just to be clear on one thing, though.  Do you have to do the HTML inside the servlet?  Can you not use JSPs to produce this fragment?
Or even simply return all the data as JSON and let the front end sort it out?
 
Sheriff
Posts: 23710
50
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Dave Tolls wrote:As for the problem itself, I can't tell where you expect the comtval to go.



My guess is that the "function" it's supposed to go to is a JavaScript function. Which is a problematic design, since this code is running on the server and knows nothing about JavaScript in the browser. And then, apparently, the resulting HTML is supposed to be returned to the browser, to be handled by some AJAX code.

If that's the case then this design isn't going to work. You'll have to return the comtval data as part of the HTML and then have the AJAX code call that function. Just as Dave suggested, in fact.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!