wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes problem with jquery post request Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "problem with jquery post request " Watch "problem with jquery post request " New topic
Author

problem with jquery post request

Pawan Arora
Ranch Hand

Joined: Sep 14, 2008
Posts: 105
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

Joined: Jan 10, 2002
Posts: 60782
    
  65

Have you used a tool such as Firebug to verify that the response is returning the value that you expect?

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Pawan Arora
Ranch Hand

Joined: Sep 14, 2008
Posts: 105
I'm alreay using it, and I'm not getting any error, but alert box still displaying blank output.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Do you see the form parameters being sent up with Firebug or Fiddler?

Eric
Pawan Arora
Ranch Hand

Joined: Sep 14, 2008
Posts: 105
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
Status 0 normally means you are running on a protocol other than http.
Pawan Arora
Ranch Hand

Joined: Sep 14, 2008
Posts: 105
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem with jquery post request
 
Similar Threads
How to redirect another page with value object fron ajax request
Servlet+jQuery
how to call javascript function on body load using jquery
jQuery getJSON question
Jquery ajax issue