• Post Reply Bookmark Topic Watch Topic
  • New Topic

calling servlet from jquery

 
Archana Jain
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a simple code in jsp file which is not hitting the servlet. Can I know what is wrong in the below code?

JSP file:-



Servlet file:-

 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35716
412
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Archana,
Welcome to CodeRanch! I added [ code ] tags to make the post easier to read.

Can you try a few debugging things?
1) Look at the JavaScript console in your browser to see if there are any JavaScript errors?
2) Add alert("here"); before var P="123"; to see if it is even entering your jQuery code.
3) Look at the server log to see if there is a Servlet configuration error.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also look at the Network pane of the browser's debugger. it'll show you if the call is even being made.

Your URLs shouldn't be absolute. They should be server-relative, starting with the context path of the servlet. See the ServletsFaq foe more info on URL paths.
 
Archana Jain
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply. I got it resolved. It was Allow-Origin Problem
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!