Bug Tracker

Modify

Ticket #2175 (closed bug: invalid)

Opened 5 years ago

Last modified 3 years ago

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:1 Changed 5 years ago by brandon

  • Priority changed from critical to major

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

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:3 Changed 5 years ago by flesler

  • Milestone changed from 1.2.3 to 1.2.4

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.

comment:6 Changed 4 years ago by atula

I've assumed you've used $.ajax as well as the wrapper $.post ?

$.ajax({

type: POST, url : "my_page.jsp", dataType : 'json', data: {parmPolVerPlanLocNo: polVerPlanLocNo,

parmPolItemInsNo: polItemInsNo},

success: function (json) {

}

});

comment:7 Changed 3 years ago by john

  • Status changed from reopened to closed
  • Resolution set to invalid

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.