• Post Reply Bookmark Topic Watch Topic
  • New Topic

Sending response to ajax from Java  RSS feed

 
srikanth darbha
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
 
Dave Tolls
Ranch Foreman
Posts: 3001
37
  • 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?
 
Paul Clapham
Sheriff
Posts: 22701
43
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!