Ticket #2175 (closed bug: invalid)
Ajax POST does not work
| Reported by: | awrigh2 | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 1.3 |
| Component: | ajax | Version: | 1.2.2 |
| Keywords: | Cc: | awrigh2, flesler | |
| Blocking: | Blocked by: |
Description
I am passing a parameter to the server using ajax, and the type: GET works, but the type: POST does not work.
Change History
comment:2 Changed 5 years ago by flesler
- Status changed from new to closed
- Resolution set to invalid
4 months, enough for such a generic ticket.
comment:4 Changed 4 years ago by brostbeef
- Status changed from closed to reopened
- Resolution invalid deleted
Using jQuery to access a JSP page sending two parameters as a JSON object. Parameters are null when retrieved.
Example: (jQuery code) $.get("my_page.jsp", {
parmPolVerPlanLocNo: polVerPlanLocNo, parmPolItemInsNo: polItemInsNo
}, function(json){
my func
});
JSP code to retrieve: Integer polVerPlanLocNo = new Integer(request.getParameter("parmPolVerPlanLocNo")); Integer polItemInsNo = new Integer(request.getParameter("parmPolItemInsNo"));
The above gives me a parse int error because variables are NULL
Please note that this did not fail from the very beginning. It started to die later on. Also, it does seem to work depending on the server it is on. We have a few local servers and one server will work fine while the next will fail on the code. Changing to $.get() fixes the problem immediately. I wish I could show you live code, but this is for an internal product.
comment:5 Changed 4 years ago by flesler
- Cc awrigh2, flesler added
- need changed from Review to Test Case
- Milestone changed from 1.2.4 to 1.3
You say $.get works, and in the example, you use $.get...
The fact is, that both $.post and $.get do work. If you're experimenting a problem, then something special must be happening.
We can't do much with the info you provide.
Let me know if you can add something else, or then tell me and I'll close this.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Could you attach a test case where this isn't working for you?