• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

using JQuery with Spring 3

 
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Spring 3.0.5
jQuery 1.5.2

Hello:

I have been trying to make an ajax call with jQuery:


My controller:


I followed the example at http://blog.springsource.com/2010/01/25/ajax-simplifications-in-spring-3-0/ but I'm missing something. The communication gets lost sometime in the response . . . the callback never fires.

Can somebody give me a hint?

Thanks
Eric
 
author
Posts: 24
5
Spring Tomcat Server Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would try making the equivalent request without ajax to see if it caused an error and hence prevented the output from being delivered. One way to test web-service calls (well, besides regular GET requests) is to use Firefox' POSTER plugin (https://addons.mozilla.org/en-us/firefox/addon/poster/). Additionally, give jquery a chance to notify you of the error with an error callback (see http://stackoverflow.com/questions/1740218/error-handling-in-getjson-calls for information on that)
 
Sheriff
Posts: 67637
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Page-relative URLs are always suspect and fragile.
 
John Eric Hamacher
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, I get a 406 response "Not Acceptable". I'm looking into that now . . . .
 
John Eric Hamacher
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can't solve this 406 . . . added "headers" to @RequestMapping



I put the Jackson jar in my classpath as was recommended.

 
John Eric Hamacher
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I figured it out. There are two Jackson jars, core and mapper. You need both in your classpath.


Thanks for the help!

Eric
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic