Win a copy of Pro Spring MVC with WebFlux: Web Development in Spring Framework 5 and Spring Boot 2 this week in the Spring 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

Ajax and Jquery

 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi folks,


This is my first experiment with jquery and ajax

What i want to achieve is to call an action from the jsp using jquery and supposedly an ajax request . Nothing seems to be happening . What am i missing

The JSP and Action class code can be viewed below


Here is my jsp snippet



and here is the action class




Cheers
n4v33n
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you go to http://localhost:9080/enterprize-sourcing/RFxForXML.do?rfxId=487085942, does it produce proper xml?

Does the onclick get called? Are you canceling the links default action?

Eric
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I see a few glaring problems in your code. First, ID attributes shouldn't have any spaces in them. Secondly, when you look up an element by it's ID in jQuery you have to prefix it with # so something like $('#someId'). And lastly, you don't need the onload shortcut that you have on line 14 because you've already done this on line 5.

Fix those issues then let us know.
 
Naveen puttu
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Eric

Yes, when i visit the link http://localhost:9080/enterprize-sourcing/RFxForXML.do?rfxId=487085942 . i can see a beautiful xml on the browser

@Gregg

Well , i appreciate your response mate . i actually nailed this issue . Please dont laugh when i disclose the root cause

i was using jquery.1.2.6.jar and the code wasnt compatible with the jar that i was using

Appreciate your responses immensely

Cheers
n4v33n
 
reply
    Bookmark Topic Watch Topic
  • New Topic