• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with jquery post request

 
Pawan Arora
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I don't know the reason of getting blank data in alert box, whenever I do the post request to servlets from jquery after clicking login button.

Here's the code which's making me bugged:





the request is passing to servlets(which is mapped to Check.do URL), and in doPost method in servlets I'm just doing:





May I know what's the reason of getting an error in above code, and how can I sort this problem out?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65217
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you used a tool such as Firebug to verify that the response is returning the value that you expect?
 
Pawan Arora
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm alreay using it, and I'm not getting any error, but alert box still displaying blank output.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you see the form parameters being sent up with Firebug or Fiddler?

Eric
 
Pawan Arora
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, if I set async to false with post request in $.ajax(options) method, I can get the output as "HELLO" in alert dialog box. otherwise I'm getting the status code as "0" with no data in response. May I know why?
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Status 0 normally means you are running on a protocol other than http.
 
Pawan Arora
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But I'm sending request from JSP page to servlets, which has extended HttpServlet class, so how that request couldn't be on http protocol?
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Other cause is you are not canceling the default action of the form and the page is submitting. return false on your button/image clicks.

Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic