This week's book giveaway is in the Beginning Java forum.
We're giving away four copies of Get Programming with Java (MEAP only) and have Peggy Fisher on-line!
See this thread for details.
Win a copy of Get Programming with Java (MEAP only) this week in the Beginning Java forum!
  • 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

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
 
Rancher
Posts: 3803
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: 23973
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.
 
I can't take it! You are too smart for me! Here is the tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!