Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

help with jquery server responds with whole page

 
caleb momanyi
Ranch Hand
Posts: 43
Firefox Browser Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's up fellow ranchers. pretty rough day out in the fields for for me. I have started learning jquery and am trying to get a string from the server but when
i do alert(response) i find that the response is the whole jsp page from the server. how can i get just the string only. i have heard of JSON and if any one of you can
help me get started will be very thankful.

get method in servlet



jquery

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64708
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The response will contains whatever /chat returns as the response. It has nothing at all to do with what you are doing on the client. If you only want a string, then /chat has to return just that string, not a whole page.
 
caleb momanyi
Ranch Hand
Posts: 43
Firefox Browser Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you for your response sir. my problem is how to stop it from returning the whole page.

most of the examples I am seeing only explain the client side methods of handling the the response but not so well explanation for server side.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64708
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That entirely has to do with the server-side code that's responding to the /chat url. What it it? A servlet? Something else? Whatever it is, it needs to be changed to return just what you want rather than what you do not.
 
caleb momanyi
Ranch Hand
Posts: 43
Firefox Browser Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
using print writter?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64708
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have no idea. You have given us no details whatsoever on the server component.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic